Camera request processing method and related device

By setting up ordinary and special camera request buffers in electronic devices, and directly allocating cache buffers to process camera parameter change requests, it solves the problem of delay in response when users change camera shooting mode and improves user experience.

CN119450206AActive Publication Date: 2025-02-14HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310952242.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-29
Publication Date
2025-02-14
Estimated Expiration
2043-07-29

AI Technical Summary

Technical Problem

When existing electronic devices change camera shooting mode, the response delay is large, resulting in poor user experience.

Method used

By introducing two cache areas in the electronic device, the ordinary camera request buffer area and the special camera request buffer area, the ordinary camera request and the special camera request are processed respectively. The special camera request buffer is used to store camera requests for changing camera parameters, and directly allocate cache buffers without waiting for the buffer to be cleared.

Benefits of technology

Reduces the response time of users changing camera shooting mode operations, improves the response efficiency of user operations, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119450206A_ABST
    Figure CN119450206A_ABST
Patent Text Reader

Abstract

The invention discloses a camera request processing method and a related device. In the method, an electronic device may divide a buffer for storing a camera request into two parts, one part storing a normal camera request and the other part storing a special camera request. When a camera in an electronic device is started, a plurality of camera requests are distributed to a buffer storing a common camera request. When the electronic equipment receives a zoom request, the electronic equipment can directly distribute the zoom request to the buffer used for storing the special camera request and issue the zoom request to the HAL. The FWK immediately issues the zooming request to the HAL, and after the HAL receives the zooming request issued by the FWK, the zooming request can take effect on the generated image frame as soon as possible, so that the time for the electronic equipment to respond to the zooming operation of the user is shortened, namely the chirality of the zooming operation of the user can be improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and in particular to a camera request processing method and related devices. Background Art

[0002] Currently, electronic devices such as mobile phones and tablets all have camera applications. Users can take photos and videos through the camera application in the mobile phone. As the photo and video functions of camera applications in electronic devices such as mobile phones become more and more powerful, there are more and more shooting modes on electronic devices such as mobile phones. Users can change the camera's shooting mode in the camera shooting interface, such as changing the current focal length of the camera, or adding filters, etc. When the user changes the camera's shooting mode, in response to the user's operation, the shooting interface of the electronic device will display a preview image frame in the new shooting mode.

[0003] However, when the user changes the camera shooting mode in the camera shooting interface, the electronic device will have a time delay in responding to the user's operation. For example, when the user operates the camera to zoom, the electronic device will have a delay before displaying the zoomed image frame in the camera shooting interface, thus poor user experience.

[0004] Therefore, how to reduce the response delay of the electronic device to the user's operation of changing the shooting mode is an urgent problem to be solved. Summary of the invention

[0005] The present application provides a camera request processing method and related devices. Through the camera request processing method provided by the present application, the electronic device can reduce the response time to the user's operation of changing the shooting mode, which can improve the user experience.

[0006] In a first aspect, the present application provides a camera request method, which can be applied to an electronic device with a camera module. The method may include: detecting a user's operation of changing camera parameters, and issuing a first camera request; determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, and allocating the first camera request to a first cache buffer in a first cache area; a storage area in the electronic device for storing camera requests is divided into a first cache area and a second cache area, the first cache area is used to store the first camera request, the camera parameters include one or more of a zoom ratio, a focus parameter, an exposure parameter, and a filter parameter, the second camera request is a camera request obtained by the electronic device before obtaining the first camera request; obtaining a first image frame according to the camera parameters in the first camera request; and displaying the first image frame.

[0007] When the method provided in the first aspect is implemented, multiple camera requests for obtaining preview images sent when the camera in the electronic device is turned on are only stored in the second buffer area, and the first buffer area is only allocated to camera requests with changed camera parameters. When the user changes the zoom ratio, or performs focusing, exposure, or adds filters in the camera shooting interface, the electronic device can directly allocate the camera request generated based on the user operation to the special camera request buffer area, and the application framework layer does not need to wait for a buffer to be cleared before allocating it to the buffer, and the application framework layer does not need to wait for the HAL to process the next request before allocating a buffer to the camera request. In this way, the response time of the electronic device to the user's operation of changing the zoom ratio, focusing, exposure, or adding filters can be reduced, which can improve the response efficiency of user operations.

[0008] In a possible implementation, the first buffer area includes q buffers, the second buffer area includes p buffers, and the method may further include: determining the values ​​of q and p based on a camera mode of a camera application in the electronic device. In this way, the electronic device may determine different values ​​of p and q based on different modes.

[0009] In a possible implementation, the values ​​of q and p are determined based on the camera mode of the camera application in the electronic device, including: when the camera mode of the camera application is the photo mode, the value of q is determined to be the first value, and the value of p is the second value; when the camera mode of the camera application is the video recording mode, the value of q is determined to be the third value, and the value of p is the fourth value, the sum of the third value and the fourth value is the fifth value, the sum of the first value and the second value is the sixth value, and the fifth value is equal to the sixth value. In this way, the electronic device can determine different values ​​of p and q based on different modes. In this way, it can be ensured that the camera can smoothly send camera requests in different camera modes.

[0010] In a possible implementation, after detecting the operation of changing the camera parameters by the user, before sending the first camera request, the method may also include: the electronic device detects the operation of starting the camera application and starts the camera application; the camera application in the electronic device sends multiple camera requests, and the multiple camera requests include the second camera request; when there is an empty buffer in the second buffer area, the second camera request is allocated to the second buffer, and the second buffer is an empty buffer in the second buffer area; when there is no empty buffer in the second buffer area, the electronic device waits for the second buffer in the second buffer area to be cleared, and then allocates the second camera request to the second buffer. In this way, the second camera request will not be sent to the first buffer area, and when the electronic device sends the first camera request, the first buffer area is empty, and the electronic device can quickly allocate a buffer for the first camera request without waiting for the buffer to be cleared before allocating the buffer.

[0011] In a possible implementation, after determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, the method may further include: if there is an empty buffer in the second buffer area, allocating the first camera request to a second buffer in the second buffer area, the second buffer being an empty buffer. In this way, more empty buffers can be reserved for subsequent camera requests with camera parameter changes.

[0012] In a possible implementation, the user's operation of changing the first camera parameter is the user's operation of changing the zoom ratio, and the method may further include: the camera application displays a first preview interface, the first preview interface displays a second image frame, and the zoom ratio corresponding to the second image frame is the first zoom ratio; the camera detects the user's operation of changing the zoom ratio, and displays a second preview interface, the second preview interface displays the first image frame, and the zoom ratio corresponding to the first image frame is the second zoom ratio. In this way, the user can see the preview interface before and after the zoom ratio is changed in the electronic device.

[0013] In a possible implementation, the electronic device includes a request module and a cache module, and determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, and allocating the first camera request to a first cache buffer in a first cache area may include: the request module determines that the camera parameters in the first camera request are different from the camera parameters in the second camera request; the request module sends the first camera request to the cache module; the cache module allocates the first camera request to the first cache buffer in the first cache area. In this way, the cache module can quickly allocate the first camera request to the first buffer without waiting.

[0014] In a possible implementation, the electronic device may further include a camera processing module, and after the cache module allocates the first camera request to the first cache buffer in the first cache area, the method may further include: the cache module sends the first camera request to the camera processing module. In this way, the cache module can quickly send the first camera request to the camera processing module.

[0015] Acquiring the first image frame according to the camera parameters in the first camera request may include: the camera processing module sends the camera parameters in the first camera request to the camera module; the camera module acquires the first image frame according to the camera parameters in the first camera request. In this way, the electronic device can acquire the first image frame corresponding to the first camera request.

[0016] In a possible implementation, the electronic device further includes a cache module and a camera processing module. After allocating the second camera request to the second buffer, the method may further include: the cache module sending the second camera request to the camera processing module.

[0017] In a possible implementation, the electronic device may further include a camera application, a display module, and after the cache module sends the second camera request to the camera processing module, the method may further include: the camera processing module sends the camera parameters in the second camera request to the camera module, and obtains the second image frame obtained by the camera module according to the camera parameters in the second camera request; the camera processing module sends the second image frame to the display module; the display module sends the second image frame for display; and the camera application displays the second image frame. In this way, the electronic device can obtain the second image frame through each module and display the second image frame.

[0018] 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, 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, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method involved in any possible implementation method of the first aspect.

[0019] According to a third aspect, an electronic device is provided. The electronic device may include one or more functional modules, and the one or more functional modules are used for the method involved in any possible implementation manner of the first aspect.

[0020] In a fourth aspect, a chip system is provided, which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method involved in any possible implementation manner in the first aspect.

[0021] In a fifth aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute a method as involved in any possible implementation of the first aspect.

[0022] According to a sixth aspect, a computer program product is provided. When the program product is run on an electronic device, the electronic device executes the method involved in any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a schematic diagram of a user interface provided in an embodiment of the present application;

[0024] Figure 2A-2C is a set of user interface schematic diagrams provided in an embodiment of the present application;

[0025] Figure 3 It is a schematic diagram of the software and hardware architecture of an electronic device provided in an embodiment of the present application;

[0026] Figure 4 It is a schematic diagram of the duration of sending a zoom request to the HAL layer and the duration required for the electronic device to successfully respond to the zoom operation, provided by an embodiment of the present application;

[0027] Figure 5 It is a schematic diagram of the software and hardware architecture of an electronic device provided in an embodiment of the present application;

[0028] Figure 6 It is a schematic diagram of software module interaction of a camera request processing method provided in an embodiment of the present application;

[0029] Figure 7-Figure 9 is a set of user interface schematic diagrams provided in an embodiment of the present application;

[0030] Fig.10 is a schematic diagram of a camera request processing method provided in an embodiment of the present application;

[0031] Fig.11 It is a schematic diagram of the time taken for another electronic device to send a zoom request to the HAL layer and the time taken for the electronic device to successfully respond to the zoom operation provided by an embodiment of the present application;

[0032] Fig.12 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0034] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0035] Currently, there are more and more shooting modes on electronic devices such as mobile phones. Users can change the camera's shooting mode in the camera shooting interface, such as changing the camera's current focal length, or adding filters, exposure, focus and other camera parameters. In some scenarios, when users change the camera parameters on their mobile phones, the phone will freeze before displaying the preview image of the new shooting mode. This results in a poor user experience.

[0036] The user changes the focal length of the camera in the mobile phone. Figure 1 , Figure 2A-2C The following is a schematic diagram of an interface related to a user changing the focal length of a camera in a mobile phone.

[0037] Exemplarily, the electronic device 100 may display a desktop 101, in which a page with application icons is displayed, and the page includes multiple application icons (for example, a setting application icon, an application market application icon, a gallery application icon, a browser application icon, etc.). A page indicator 104 is also displayed below the multiple application icons to indicate the positional relationship between the currently displayed page and other pages. A tray area 102 is displayed below the page indicator 104. Among them, the tray area 102 includes multiple tray icons, for example, a camera application icon 103, an address book application icon, a phone application icon, and an information application icon. The tray area 102 remains displayed when the page is switched. In some embodiments, the above-mentioned page may also include multiple application icons and a page indicator 104, and the page indicator 104 may not be part of the page and exist separately. The above-mentioned tray icon is also optional, and the embodiment of the present application does not limit this.

[0038] The electronic device 100 may receive an input operation (eg, a single click) from a user on the camera application icon 103. In response to the input operation, the electronic device 100 may display a Figure 2A The shooting interface 200 is shown.

[0039] like Figure 2A As shown, the shooting interface 200 may include an echo control 203A, a shooting control 203B, a camera conversion control 203C, a preview box 201, a zoom ratio control 202, and controls for one or more shooting modes (for example, a control 204A for a large aperture shooting mode, a control 204B for a night scene shooting mode, a control 204C for a portrait shooting mode, a control 204D for a shooting mode, a control 204E for a video recording mode, a control 204F for a multi-lens video recording mode, and a control 204G for more modes).

[0040] Among them, Figure 2A As shown, the control 204D of the photo mode is selected, and the electronic device 100 is in the photo mode. The preview frame 201 displays a preview image 205 collected by the electronic device 100 through the camera in the photo mode. The echo control 203A can be used to trigger the display of the image or video that has been taken. The shooting control 203B is used to trigger the saving of the image captured by the camera. The camera conversion control 203C can be used to switch the camera of the electronic device 100 to collect images (for example, the front camera is switched to the rear camera, or the rear camera is switched to the front camera). The zoom ratio control 202 can be used to set the zoom ratio of the electronic device 100 to take photos or videos. Among them, the zoom ratio control 202 can display the currently used zoom ratio (for example, 0.6x), the commonly used zoom ratio 1 (for example, 1x) larger than the currently used zoom ratio, and the commonly used zoom ratio 2 (for example, 2x) larger than the currently used zoom ratio.

[0041] The control of the shooting mode can be used to trigger the image processing process corresponding to the shooting mode. For example, the control 204A of the large aperture shooting mode can be used to trigger the camera to shoot images using large aperture parameters. The control 204B of the night scene shooting mode can be used to trigger the increase of brightness and color richness in the captured image. The control 204C of the portrait shooting mode can be used to trigger the electronic device 100 to beautify the portrait in the captured image. The control 204D of the shooting mode can be used to trigger the electronic device 100 to shoot images using default parameters, and use the default image processing process to process the images captured by the camera. The control 204E of the video recording mode can be used to trigger the electronic device 100 to record a video through a single camera. The control 204F of the multi-lens video recording mode can be used to trigger the electronic device 100 to record a video simultaneously through multiple cameras. The more mode control 204G can be used to trigger the electronic device 100 to display more shooting mode controls.

[0042] The electronic device 100 may receive a user input operation (e.g., clicking on the commonly used zoom magnification 1 (e.g., 1x)) for the zoom magnification control 202. In response to the input operation, the zoom magnification of the electronic device 100 may be switched from the currently used zoom magnification to the commonly used zoom magnification 1.

[0043] When the camera application of the electronic device 100 sends a large number of camera requests before the electronic device 100 receives the user's input operation for the zoom magnification control 202, the electronic device 100 will have a delay in processing the zoom magnification change request. This will cause the preview image of the electronic device 100 to freeze for a while before displaying the preview image after the zoom magnification is changed.

[0044] For example, Figure 2B As shown, Figure 2B The zoom magnification control 202 in the user interface 210 shown in FIG. 1 shows that the currently used zoom magnification is 1x. A freeze occurs in the preview frame 201, and no preview image is displayed. After the preview frame 201 freezes for a period of time, the electronic device 100 may display a user interface 220 in which the zoom magnification can be switched from the currently used zoom magnification to the commonly used zoom magnification 1.

[0045] like Figure 2C As shown, the user interface 220 of the electronic device 100 may display a preview image 221 obtained after the electronic device 100 switches from the currently used zoom magnification (eg, 0.6x) to the commonly used zoom magnification 1 (eg, 1x).

[0046] like Figure 2A-2B As shown, when the user operates the camera to zoom, the electronic device will have a delay before displaying the zoomed image frame on the camera shooting interface, thus resulting in a poor user experience.

[0047] Figure 3 A schematic diagram of the software and hardware architecture of a camera service on an electronic device provided in an embodiment of the present application is shown.

[0048] like Figure 3 As shown, the layered architecture divides the system into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the hardware abstraction layer, the driver layer, and the hardware layer.

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

[0050] The application package may include a camera application, etc.

[0051] The application framework layer (Frameworks, FWK) provides application programming interface (application programming interface, API) and programming framework for the application packages of the application layer. The application framework layer includes some pre-defined functions.

[0052] In some embodiments, the application framework layer may include a camera interface, which may include an image acquisition interface (eg, capture() interface) and a continuous image acquisition interface (eg, setRepeatingRequest() interface).

[0053] In some embodiments, the application framework layer may also include a request queue (RequestQueue) module, which may include camera requests such as capture request 1 (Capturerequest1) and capture request 2 (Capturerequest2) issued by the camera application through the capture() interface, and continuous photo taking or preview requests (Repeating Request) issued through the setRepeatingRequest() interface.

[0054] In some embodiments, the application framework layer may also include a request queue processing (RequestThread) module. The request queue processing module may include a waiting request (WaitForRequest) module, a sending batch request (SendRequestsBatch) module, and a preparing hardware abstraction layer request (PrepareHardwareAbstractionLayerRequest, which can be referred to as PrepareHALRequest) module. Among them, the WaitForRequest module can be used to keep the camera request (for example, Capturerequest1) to be executed in the request queue module waiting when there is no empty buffer in the N cache buffers allocated to the camera request of the camera application in the buffer area of ​​the electronic device. The PrepareHALRequest module can be used to construct the Capturerequest of the HAL layer and the output buffers of the output. When there is an empty buffer in the N cache buffers allocated to the camera request of the camera application, the PrepareHALRequest module can obtain a buffer from the AllocateBuffer interface for the camera request issued by the camera application. The Send module can be used to send the Capture request of the HAL layer constructed by the PrepareHALRequest module to the HAL layer.

[0055] For example, the above N may be 8, that is, the number of buffers allocated by the electronic device to the camera application for the camera request may be 8. N may also be other values, for example, 7, or 9, etc., and the embodiment of the present application does not limit the value of N. The following description takes the value of N as 8 as an example.

[0056] In some embodiments, the application framework layer may further include an Allocate Buffer interface, which is used to allocate a buffer to a camera request sent by a camera application. Exemplarily, the AllocateBuffer interface may specify an address of a buffer for storing the camera request to the camera request.

[0057] In some embodiments, the application framework layer may also include a display service module, which may be used to obtain the image frame uploaded by the HAL layer and send the obtained image frame for display. When the image frame is successfully sent for display, the buffer storing the successfully displayed image frame is cleared. The display service module may notify the Allocate Buffer interface to store the buffer address of the successfully displayed image frame.

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

[0059] The hardware abstraction HAL layer is an interface layer located between the application framework layer and the driver layer, providing a virtual hardware platform for the operating system.

[0060] The hardware abstraction HAL layer may include a camera hardware abstraction layer. The camera hardware abstraction layer may be used to receive camera requests sent by the application framework layer, and send the camera parameters in the camera request and the buffer address of the camera request to the camera module through the driver layer. The interface that returns the result (for example, ProcessCaptureResult) may also be called to send the image frame obtained by the camera module according to the camera parameters to the display service in the application framework layer.

[0061] Optionally, the camera hardware abstraction layer may include a camera request waiting module and a camera hardware abstraction processing module. The camera request waiting module and the camera hardware abstraction processing module are Figure 3 For details about the camera request waiting module and the camera hardware abstract processing module, please refer to the following Figure 5 .

[0062] The camera request waiting module can be used to receive the camera request sent by the application framework layer. When the camera hardware abstract processing module completes processing a camera request, the camera request waiting module can send a new camera request to the camera hardware abstract module.

[0063] The camera hardware abstract processing module can send the camera parameters in the new camera request and the buffer address of the camera request to the camera module through the driver layer. The camera request processing module can also call the return result interface (e.g., ProcessCaptureResult) to send the image frame obtained by the camera module according to the camera parameters to the display service in the application framework layer.

[0064] The driver layer is a layer between hardware and software. The driver layer includes drivers for various hardware. The driver layer may include camera drivers, image processor drivers, and display drivers, etc. Among them, the camera driver is used to drive the image sensors (e.g., image sensor 1, image sensor 2, etc.) of one or more cameras in the camera module to capture images and drive the image signal processor to pre-process the image. The image processor driver is used to drive the graphics processor to process images. The display driver is used to drive the display.

[0065] The hardware layer may include a camera module, an image signal processor, a display, and the like. The camera module may include one or more image sensors of the camera (e.g., image sensor 1, image sensor 2, and the like). Optionally, the camera module may also include a time of flight (TOF) sensor, a multispectral sensor, and the like. The image signal processor may be used to process the image frames collected by the camera module. The display may be used to display the image frames sent by the display service module.

[0066] In the embodiment of the present application, the request module may be a queue request module, the cache module may be an allocation cache interface module, the camera processing module may be a camera hardware abstraction processing module, and the display module may be a display service module.

[0067] In combination with the above system structure, the following specifically describes the processing mechanism of the camera request generated by the electronic device 100 based on the user's operation for changing the focal length, taking zoom as an example:

[0068] ①. The electronic device 100 receives an operation from the user to start the camera application, and sends multiple camera requests for obtaining preview images.

[0069] When the electronic device 100 receives an operation from the user to start the camera application (for example, Figure 1After the user clicks the camera application icon 103, the electronic device 100 starts the camera application. The camera application can send multiple camera requests for obtaining preview images, and the camera request for obtaining preview images sent by the camera application for the first time can fill up the N buffers reserved for camera requests in the cache area.

[0070] It is understandable that after the camera application is turned on, it can periodically send requests to the buffer and obtain corresponding image frame data according to the requests.

[0071] ②. The application framework layer of the electronic device 100 places N requests of the multiple preview image requests into N buffers in sequence according to the order of issuance time.

[0072] The application framework layer of the electronic device 100 may place N requests among the multiple preview image requests into N buffers in sequence according to the order of issuance time.

[0073] The application framework layer can sequentially send the camera requests in the N buffers to the HAL layer. The HAL layer sequentially processes the camera requests in the N buffers, informs the camera module of the camera parameters and buffer addresses in the camera requests, and the camera module can obtain the image frame according to the camera parameters and store the image frame in the buffer corresponding to the buffer address. The HAL obtains the image frame and uploads it to the application framework layer, and then the application framework layer can send the image frame for display. After successful display, the image frame can be displayed in the preview box of the shooting interface of the camera application. After successful display, the buffers in the N buffers where the image frame and the camera request corresponding to the image frame are placed can be cleared. The application framework layer can allocate one of the remaining camera requests in the multiple camera requests to the cleared buffer. The application framework layer will sequentially allocate the remaining camera requests in the multiple camera requests to the cleared buffers in the N buffers.

[0074] It can be understood that the process of the HAL layer processing the camera request can refer to the description in the following steps 3, 4, and 5, which will not be repeated here.

[0075] ③. The electronic device 100 receives the user's operation on the camera application and sends a camera request.

[0076] The electronic device 100 may receive an operation of the user on the camera application, for example, an operation to change the focal length magnification. Based on the user operation, the camera application in the electronic device 100 will issue a camera request. The request queue module in the application framework layer of the electronic device 100 may obtain the camera request through the setRepeatingRequest() interface or the capture() interface in the camera interface. When there is an empty buffer in the N buffers reserved for the camera request in the cache area of ​​the electronic device 100, the electronic device 100 may issue the camera request from the request queue module to the preparation HAL request module in the request queue processing module. After the preparation HAL request module obtains the buffer address allocated by the Allocate Buffer interface for the camera request, the camera request may be stored in the buffer. The preparation HAL request module may construct the camera request into a Capture request of the HAL layer, and issue it to the camera request waiting module in the HAL layer through the batch request issuing module. When the previous camera request processed by the camera hardware abstract module has been processed, the camera request waiting module may send the camera request to the camera hardware abstract processing module. Then, the camera hardware abstract processing module can send the camera parameters in the new camera request and the buffer address of the camera request to the camera module through the driver layer.

[0077] ④. The electronic device 100 turns on the camera and obtains the image frame taken by the camera based on the camera request.

[0078] The camera driver in the electronic device 100 can receive the camera parameters sent by the camera hardware abstract processing module and the buffer address of the camera request. Then, the camera driver can send the camera parameters and the buffer address of the camera request to the camera module. The camera module can obtain image frames according to the camera parameters and store the obtained image frames in the buffer corresponding to the buffer address carried by the camera request.

[0079] In some examples, the image frames acquired by the camera module can be transmitted to the image signal processor, which can pre-process the image frames and upload them to the HAL layer through the camera driver or the image processor driver. The HAL layer can upload the image frames to the display service in the application framework layer.

[0080] In some examples, the HAL layer can upload the image frame to the camera application through the application framework layer, and the camera application can process the image frame before sending it to the display service.

[0081] ⑤. The electronic device 100 displays the image frame.

[0082] The display service can send the image frame for display, that is, notify the display to display the image frame through the display driver. That is, the display of the electronic device 100 can display the image frame. After the display successfully sends the image frame for display, it will notify the display service that the image frame is successfully displayed. It can be understood that after the image frame is sent for display, the buffer storing the image frame and the camera request for obtaining the image frame in the cache of the electronic device will be cleared. The display service can send the address of the cleared buffer to the AllocateBuffer interface. The Allocate Buffer interface can subsequently assign the address of the cleared buffer to the next camera request.

[0083] For example, Figure 3 As shown, when the queue request module sends the photo request 1, buffer 8 is idle. Then the HAL request preparation module can obtain the buffer for the photo request 1 from the Allocate Buffer interface. The Allocate Buffer interface can allocate the photo request 1 to buffer 8. After allocating the buffer, the HAL request preparation module can send the photo request 1 to the batch request sending module. Then. The batch request sending module can send the photo request 1 to the HAL layer. The photo request 1 can wait in the request queue of the HAL layer for the HAL layer to process.

[0084] When the user can change the current zoom ratio in the camera application interface, the camera application can send a photo request 2. Since there is no empty buffer in the cache area, the request queue module can send the photo request 2 to the waiting request module to wait for an empty buffer. When the photo request 1 in the preparation HAL request module is sent to the HAL layer by the sending batch request module, the sending batch request module can notify the waiting request module. Then, the waiting request module can send the photo request 2 to the preparation HAL request module.

[0085] The HAL layer can first process the request in buffer1 and return the image frame corresponding to the request in buffer1 to the display service module. The display service module can display the image frame. When the display is successful, the display service module can return the address of buffer1 to the Allocate Buffer interface. Then, the Allocate Buffer interface can allocate buffer1 to the photo request 2. After allocating the buffer, the HAL request can be prepared to send the photo request 2 to the batch request module. Then. The batch request module can send the photo request 2 to the HAL layer. Photo request 2 can wait for the HAL layer to process it in the request queue of the HAL layer. The HAL layer needs to process the requests in buffer2 to buffer8 in the order in which the requests are sent, and then process the photo request 2.

[0086] According to the above-mentioned camera request processing mechanism, if there is a free buffer among the N buffers allocated by the electronic device 100 for the camera request of the camera application, the application framework layer of the electronic device 100 can always send the camera request issued by the camera application to the HAL layer. If there is no free buffer among the N buffers allocated by the electronic device 100 for the camera request of the camera application, the HAL layer needs to successfully process a camera request and return the processing request result (for example, the image frame obtained according to the camera parameters of the camera request) to the display service of the application framework layer. The display service will clear a buffer only after it is successfully sent for display.

[0087] When the user turns on the camera application, the camera application can send multiple camera requests for obtaining preview images. Since the number of buffers used to store camera requests is limited (for example, 8), the camera requests sent by the camera application will fill the buffer. When the user clicks the zoom ratio control to switch the current zoom ratio (for example, 0.6x) to another zoom ratio (for example, 1x), in response to the operation, the camera application of the electronic device 100 can send a camera request, which can carry the user's newly selected zoom ratio (for example, 1x). The electronic device 100 needs to wait for the HAL to process the camera request in a buffer and clear a buffer before the electronic device 100 can allocate the buffer for the camera request carrying the user's newly selected zoom ratio and send it to the HAL layer. In this way, when the HAL layer processes a request slowly, resulting in a slow output of a certain frame, it will not only affect the slow display of the current frame and cause jamming, but also cause subsequent camera requests to be unable to be sent to the HAL layer in time, thereby making the jamming problem more and more serious. In this way, the user experience is poor.

[0088] Figure 4The diagram exemplarily shows the time taken for the electronic device 100 to receive an operation from the user to change the zoom ratio, the time taken for the electronic device 100 to send a request corresponding to the operation to the HAL layer, and the time taken for the electronic device 100 to respond to the user operation and successfully display the image frame corresponding to the user operation.

[0089] like Figure 4 As shown in FIG. 1 (a), after the camera application of the electronic device 100 is turned on, the initial camera request (for example, Figure 4 In request 1) shown in (a) of the figure, the zoom ratio can be 0.6x. Before the user changes the zoom ratio of the camera, the camera module of the electronic device 100 acquires image frames at a zoom ratio of 0.6x. After the user changes the zoom ratio of the camera to 1.0x, the sensor (e.g., touch sensor) in the screen (also referred to as a display or display screen) of the electronic device 100 can acquire the user's touch operation. After acquiring the user operation, the camera application of the electronic device 100 issues a camera request (e.g., Figure 4 The request n (zoom: 1.0 (indicating a zoom ratio of 1.0x)) is shown. Taking the number of buffers in the cache area for storing camera requests in the electronic device 100 as 8 as an example, when all 8 buffers store camera requests, the time for the camera request carrying a new zoom ratio sent by the camera application in the electronic device 100 to be sent to the HAL layer through the application framework layer is z1, and the calculation formula of z1 can be as follows:

[0090] z1=x+y11+v(Formula 1)

[0091] In the above formula 1, x is the duration of the screen sensor of the electronic device 100 detecting the user operation, and then the camera application converts the user operation into a corresponding camera request and sends it to FWK. y11 is the duration of the HAL processing the request in buffer1, obtaining the image frame 401 corresponding to the request, and returning the image frame 401 to FWK, and FWK successfully displays the image frame 401. v is the duration of the FWK allocating a buffer for the zoom request and sending the zoom request to HAL.

[0092] like Figure 4 As shown in FIG. 1( b ), the duration for the electronic device 100 to receive the user's zoom operation and successfully display the corresponding image frame is T1, and the calculation formula of T1 can be as follows:

[0093] T1=x+y11+v+y12+y13+y14+y15+y16+y17+y18+y19 (Formula 2)

[0094] In the above formula 2, y12 is the time length that HAL processes the request in buffer2, obtains the image frame 402 corresponding to the request, returns the image frame 402 to FWK, and FWK successfully displays the image frame 402. y13 is the time length that HAL processes the request in buffer3, obtains the image frame 403 corresponding to the request, returns the image frame 403 to FWK, and FWK successfully displays the image frame 403. y14 is the time length that HAL processes the request in buffer4, obtains the image frame 404 corresponding to the request, returns the image frame 404 to FWK, and FWK successfully displays the image frame 404. y15 is the time length that HAL processes the request in buffer5, obtains the image frame 405 corresponding to the request, returns the image frame 405 to FWK, and FWK successfully displays the image frame 405. y16 is when HAL processes the request in buffer6, obtains the image frame 406 corresponding to the request, and returns the image frame 406 to FWK, and the duration that FWK successfully displays the image frame 406. y17 is when HAL processes the request in buffer7, obtains the image frame 407 corresponding to the request, and returns the image frame 407 to FWK, and the duration that FWK successfully displays the image frame 407. y18 is when HAL processes the request in buffer8, obtains the image frame 408 corresponding to the request, and returns the image frame 408 to FWK, and the duration that FWK successfully displays the image frame 408. y19 is when HAL processes the zoom request, obtains the image frame 409 corresponding to the zoom request, and returns the image frame 409 to FWK, and the duration that FWK successfully displays the image frame 409.

[0095] from Figure 4 It can be seen from Figures (a) and (b) in that when the HAL layer processes a request slowly, resulting in a slow output of a certain frame (for example, the image frame 401 corresponding to the request in buffer1), it will not only affect the slow display of the current frame, causing a freeze. It will also make y11 become relatively large, so that not only will the time z1 for the electronic device 100 to receive the zoom operation and send the zoom request corresponding to the zoom operation to the HAL be prolonged, but also the total time T1 for the electronic device 100 to respond to the user's zoom operation will be prolonged. In this way, the camera request generated by the camera application of the electronic device 100 based on the user's zoom operation cannot be sent to the HAL layer in time, making the freeze problem more and more serious. In this way, the user experience is poor.

[0096] In order to reduce the chirality delay time of camera-related parameters (such as zoom, focus, exposure, and filter) and improve user experience, an embodiment of the present application provides a camera request processing method, which may include: the application framework layer in the electronic device 100 sets P buffers of the N buffers used to store the camera request sent by the camera application as buffers for storing ordinary camera requests, and sets q buffers of the N buffers as buffers for storing special camera requests. The camera application of the electronic device 100 is turned on, and the application framework layer in the electronic device 100 stores multiple camera requests sent by the camera application in p buffers in sequence. The HAL layer in the electronic device 100 can send the multiple camera requests stored in the p buffers in sequence to the camera module to obtain image frames and return the image frames to the application framework layer for display. After receiving the user's operation on the shooting interface of the camera application, the camera application of the electronic device 100 sends a first camera request to the application framework layer. When the application framework layer determines that the first parameter in the first camera request has changed, the application framework layer stores the first camera request in buffer21 of the q buffers. Then, the HAL layer can send the first camera request in buffer21 to the camera module to obtain the corresponding image frame and return it to the application framework layer for display. When the application framework layer determines that the first parameter in the first camera request has not changed, if there is no empty buffer in the p buffers, the application framework layer waits for the HAL layer to process the camera request in buffer11 in the p buffers, and then stores the first camera request in buffer11 and sends the first request to the HAL layer. After the HAL layer processes the camera requests before the first camera request, the HAL layer can send the first camera request to the camera module to obtain the image frame and return the image frame to the application framework layer for display. The first parameter may include focal length, focus, exposure, filter, etc.

[0097] In an embodiment of the present application, a camera request in which the parameters such as focal length, focus, exposure, filter, etc. have not changed compared to the parameters such as focal length, focus, exposure, filter, etc. in the previous camera request can be called a normal camera request; a camera request in which the parameters such as focal length, focus, exposure, filter, etc. have changed can be called a special camera request.

[0098] Figure 5 The software and hardware architecture of the camera service of an electronic device 100 provided in an embodiment of the present application is exemplarily shown.

[0099] like Figure 5As shown, the system of the electronic device 100 can be divided into five layers, namely, the application layer, the application framework layer, the hardware abstraction layer, the driver layer and the hardware layer from top to bottom. Figure 5 For details on other modules included in the driver layer and hardware layer and their connections with other layers, see Figure 3 Among them, the buffer allocation interface in the application framework layer can divide the buffer used to store camera requests into a common camera request storage area and a special camera request storage area.

[0100] For detailed descriptions of the application layer, application framework layer, hardware abstraction layer, driver layer, and hardware layer, see Figure 3 The description in will not be repeated here.

[0101] See also Figure 5 Based on the system structure of the electronic device, a camera request processing method provided by an embodiment of the present application may include:

[0102] 1. The electronic device 100 receives an operation from a user to start a camera application, and sends multiple camera requests R1 for obtaining preview images.

[0103] When the electronic device 100 receives an operation from the user to start the camera application (for example, Figure 1 After the user clicks the camera application icon 103 as shown, the electronic device 100 starts the camera application. The camera application can send multiple camera requests for obtaining preview images (for example, camera request R11, camera request R12, ..., camera request R1m). When the user does not operate the focal length, focus, exposure, and filter parameter setting controls, the focal length, focus, exposure, filter and other parameters carried in the camera request sent by the camera application will not change. Because the application framework layer sets p buffers out of the N buffers used to store the camera requests sent by the camera application as buffers for storing ordinary camera requests, and sets q buffers out of the N buffers as buffers for storing special camera requests. Therefore, the multiple camera requests sent by the camera application for the first time will not fill up the N buffers.

[0104] For example, Figure 5As shown, there may be 8 buffers for storing camera requests in the electronic device 100, namely, buffer1, buffer2, buffer3, buffer4, buffer5, buffer6, buffer7, and buffer8. In the application framework layer of the electronic device 100, buffer1, buffer2, buffer3, and buffer4 may be set to store ordinary camera requests. The application framework layer may also set buffer5, buffer6, buffer7, and buffer8 to store special camera requests.

[0105] 2. The application framework layer of the electronic device 100 places P camera requests among the multiple camera requests for obtaining preview images into P buffers in sequence according to the order of issuance time.

[0106] The application framework layer of the electronic device 100 may place P requests among the multiple camera requests into P buffers in sequence according to the order of issuance time.

[0107] The application framework layer can sequentially send the camera requests in the P buffers to the HAL layer. The HAL layer sequentially processes the camera requests in the P buffers, informs the camera module of the camera parameters and buffer addresses in the camera requests, and the camera module can obtain the image frame according to the camera parameters and store the image frame in the buffer corresponding to the buffer address. The HAL obtains the image frame and uploads it to the application framework layer, and then the application framework layer can send the image frame for display. After successful display, the image frame can be displayed in the preview box of the shooting interface of the camera application. After successful display, the buffers in the P buffers where the image frame and the camera request corresponding to the image frame are placed can be cleared. The application framework layer can allocate one of the remaining camera requests in the multiple camera requests R1 to the cleared buffer. The application framework layer will sequentially allocate the remaining camera requests in the multiple camera requests R1 to the cleared buffers in the P buffers.

[0108] For example, Figure 5As shown, the application framework can first allocate 4 of the multiple camera requests for obtaining preview images to buffer1, buffer2, buffer3, and buffer4 in sequence. In some examples, when the camera application is turned on, the camera application can continuously send camera requests for obtaining preview images, and 30 camera requests for obtaining preview images can be sent in one second. When the camera request in buffer1 is processed, the application framework layer can send another camera request to buffer1. When the camera request in buffer2 is processed, the application framework layer can send another camera request to buffer2. Buffer1, buffer2, buffer3, and buffer4 can store multiple camera requests for obtaining preview images sent by the camera application in turn.

[0109] 3. The electronic device 100 receives the user's operation on the camera application and sends a camera request R2.

[0110] The electronic device 100 may receive a user operation on the camera application, such as an operation to change the focal length magnification. Based on the user operation, the camera application in the electronic device 100 may issue a camera request R2. The request queue module in the application framework layer of the electronic device 100 may obtain the camera request R2 through the setRepeatingRequest() interface or the capture() interface in the camera interface.

[0111] 4. If the application framework layer of the electronic device 100 determines that the first parameter in the camera request R2 has changed, the camera request is allocated to buffer(p+1) among the Q buffers; if the application framework layer of the electronic device 100 determines that the first parameter in the camera request R2 has not changed, the camera request R2 is allocated to buffer1 after buffer1 among the P buffers is cleared.

[0112] The application framework layer of the electronic device 100 can determine that the first parameter (e.g., zoom ratio) in the camera request R2 has changed. Exemplarily, the request queue processing module in the application framework layer can compare the camera request R2 with the previous camera request. If the zoom ratio in the previous camera request is 0.6x and the zoom ratio in the camera request R2 is 1.0x, the request queue processing module can confirm that the first parameter in the camera request R2 has changed. The allocation buffer interface in the application framework layer can allocate the camera request R2 to any buffer in the special camera request buffer, such as buffer5. Since the multiple camera requests issued when the camera is turned on are not allocated to buffer5, buffer6, buffer7, and buffer8, buffer5, buffer6, buffer7, and buffer8 are all empty buffers, that is, the camera request has not been stored, so the camera request R2 can be directly allocated to buffer5 without waiting for the buffer to be cleared before being allocated to the buffer.

[0113] If the application framework layer of the electronic device 100 determines that the first parameter in the camera request R2 has not changed, then after waiting for buffer1 in the P buffers to be cleared, the camera request R2 is allocated to buffer1. Exemplarily, the request queue processing module in the application framework layer can compare the camera request R2 with the previous camera request. If the zoom ratio, focus, exposure, filter and other parameters in the previous camera request are the same as the zoom ratio, focus, exposure, filter and other parameters in the camera request R2, then the request queue processing module can confirm that the first parameter in the camera request R2 has not changed. The allocation buffer interface in the application framework layer can allocate the camera request R2 to the buffer in the ordinary camera request buffer. Since the multiple camera requests issued by the camera application will fill the buffer in the ordinary camera request buffer (that is, buffer1, buffer2, buffer3 and buffer4 all store camera requests), it is necessary to wait for one of buffer1, buffer2, buffer3 and buffer4 to be cleared before allocating the camera request R2 to the cleared buffer.

[0114] 5. The electronic device 100 turns on the camera and obtains the image frame captured by the camera based on the camera request.

[0115] The camera driver in the electronic device 100 can receive the camera parameters sent by the camera hardware abstract processing module and the buffer address of the camera request. Then, the camera driver can send the camera parameters and the buffer address of the camera request to the camera module. The camera module can obtain image frames according to the camera parameters and store the obtained image frames in the buffer corresponding to the buffer address carried by the camera request.

[0116] In some examples, the image frames acquired by the camera module can be transmitted to the image signal processor, which can pre-process the image frames and upload them to the HAL layer through the camera driver or the image processor driver. The HAL layer can upload the image frames to the display service in the application framework layer.

[0117] In some examples, the HAL layer can upload the image frame to the camera application through the application framework layer, and the camera application can process the image frame before sending it to the display service.

[0118] 6. The electronic device 100 displays the image frame.

[0119] The display service can send the image frame for display, that is, notify the display to display the image frame through the display driver. That is, the display of the electronic device 100 can display the image frame. After the display successfully sends the image frame for display, it will notify the display service that the image frame is successfully displayed. It can be understood that after the image frame is sent for display, the buffer storing the image frame and the camera request for obtaining the image frame in the cache of the electronic device will be cleared. The display service can send the address of the cleared buffer to the AllocateBuffer interface. The Allocate Buffer interface can subsequently assign the address of the cleared buffer to the next camera request.

[0120] For example, Figure 5 As shown, when the queue request module sends the photo request 1, buffer 4 in the ordinary camera request buffer is idle. Then the HAL request preparation module can obtain the buffer for the photo request 1 from the Allocate Buffer interface. The Allocate Buffer interface can allocate the photo request 1 to buffer 4. After allocating the buffer, the HAL request preparation module can send the photo request 1 to the batch request sending module. Then. The batch request sending module can send the photo request 1 to the HAL layer. The photo request 1 can wait in the request queue of the HAL layer for the HAL layer to process.

[0121] When the user can change the current zoom ratio in the camera application interface, the camera application can send photo request 2. Since the camera request when the camera is turned on is only allocated to the ordinary camera request buffer, the buffer in the special camera request buffer is not full. The queue request module determines that the zoom ratio in photo request 2 is different from the zoom ratio in photo request 1. The Allocate Buffer interface can allocate buffer 5 in the special camera request buffer to photo request 2, and then send it to the HAL layer. Photo request 2 can wait in the request queue of the HAL layer for processing by the HAL layer. The HAL layer needs to process the requests in buffer 1 to buffer 4 in the order in which the requests are sent, and then process photo request 2.

[0122] When the user does not change the shooting mode in the camera's shooting interface, the camera parameters of each frame of the preview image of the camera are the same, and the user will not feel that there will be a freeze between the previous image frame and the next image frame. However, if the user changes the zoom ratio, or performs focus, exposure, or adds filters in the camera's shooting interface, the current shooting mode of the camera application will be changed, and the camera parameters of the preview image in the camera's shooting interface will also change accordingly. That is, one or more of the camera parameters such as zoom ratio, focus, exposure, filter, etc. of the preview image before and after the user's operation will be different. After the user's operation, the electronic device 100 takes too long to respond, and the user will see the preview image in the new shooting mode for a long time after the operation. In this way, the user will feel the camera freeze, which will affect the user experience.

[0123] In implementing a camera request processing method provided in an embodiment of the present application, multiple camera requests for obtaining preview images issued when the camera is turned on are only stored in a part of the cache (for example, Figure 5 In the buffer1, buffer2, buffer3, buffer4 of the ordinary camera request buffer area shown in FIG, another part of the buffer (for example, Figure 5The special camera request buffer (buffer5, buffer6, buffer7, buffer8) shown in the figure is only allocated to the camera request whose first parameter has changed. When the user changes the zoom ratio, or performs focusing, exposure, or adds filters in the camera shooting interface, the electronic device 100 can directly allocate the camera request generated based on the user operation to the special camera request buffer, and the application framework layer does not need to wait for a buffer to be emptied before allocating it to the buffer, and the application framework layer does not need to wait for the HAL to process the next request before allocating a buffer to the camera request. In this way, the response time of the electronic device 100 to the user's operation of changing the zoom ratio, or performing focusing, or exposure, or adding filters can be reduced, and the response efficiency of user operations can be improved.

[0124] In the embodiment of the present application, the special camera request buffer area can be called the first buffer area, and buffer5, buffer6, buffer7, and buffer8 can all be called the first buffer. The ordinary camera request buffer area can be called the second buffer area. Buffer1, buffer2, buffer3, and buffer4 can also be called the second buffer.

[0125] Combine the following Figure 5 The software framework shown introduces in detail a camera request processing method provided in an embodiment of the present application, taking the example of a user changing the current zoom ratio in the shooting interface of the camera application after the camera application is started.

[0126] Figure 6 A schematic diagram of software module interaction of a camera request processing method in an embodiment of the present application is shown.

[0127] like Figure 6 As shown, the software framework of the electronic device 100 may include a camera application, an application framework layer (framework, FWK), and a hardware abstraction layer (hardware abstraction layer, HAL). Among them, the application framework layer may include a camera interface module 610, a request queue module 620, a request queue processing module 630, an allocation buffer interface module 640, and a display service module 650. The hardware abstraction layer may include a camera hardware abstraction layer (camera hardware abstraction layer, Camera HAL) 660.

[0128] The interaction process between the software modules of the electronic device 100 may include the following steps:

[0129] S601. The camera application detects an operation to start the camera and starts the camera application.

[0130] The camera app can detect the action of launching the camera, for example, Figure 1 The user shown in FIG. 1 can click the camera application icon 103. In response to the user operation, the camera application is started and the shooting interface of the camera application is displayed, for example, Figure 2A The shooting interface 200 is shown in FIG.

[0131] S602 . The camera application informs the allocation buffer interface module 640 of the camera mode (photographing mode or video recording mode).

[0132] Optionally, the camera application may inform the buffer allocation interface module 640 of the camera mode (photographing mode or video recording mode).

[0133] like Figure 2A As shown, after the camera application is turned on, the shooting interface 200 is displayed, such as Figure 2A As shown, the control 204D of the normal photographing mode is selected, and the camera application is in the photographing mode. When the camera application is in the photographing mode, the camera application can inform the allocation buffer area interface module 640 that the camera mode of the camera application is the photographing mode.

[0134] like Figure 7 As shown, the electronic device 100 can receive an input operation of the user selecting the control 204E for the video recording mode (eg, clicking the control 204E), and in response to the input operation, the electronic device 100 can switch from the photo taking mode to the video recording mode.

[0135] like Figure 8 As shown, the electronic device 100 can display a shooting interface 800. The control 204E of the video recording mode in the shooting interface 800 is selected, and the camera application of the electronic device 100 is in the video recording mode. After the electronic device 100 switches to the normal video recording mode, the electronic device 100 can display the preview image 802 acquired by the camera in real time in the normal video recording mode in the preview box 801, and replace the above-mentioned shooting control 203B with the recording start control 203D. After switching to the normal video recording mode, the electronic device 100 can display one or more function controls (for example, a flash control 803A, a setting control 803B, etc.) on the shooting interface 800. The flash control 803A can be used to trigger the electronic device 100 to turn on or off the flash. The setting control 803B can be used to set the shooting parameters of the electronic device 100 (for example, image size, image storage format, etc.).

[0136] When the camera application switches from the photographing mode to the video recording mode, the camera application may inform the allocation buffer interface module 640 that the camera mode of the camera application is the video recording mode.

[0137] Exemplarily, the camera application may indicate the camera mode of the camera application by sending an instruction to the allocation buffer interface module 640. Specifically, the camera application may send instruction 1 to the allocation buffer interface module 640 to indicate that the camera mode of the camera application is the photo taking mode. The camera application may send instruction 2 to the allocation buffer interface module 640 to indicate that the camera mode of the camera application is the video recording mode. For example, the content of instruction 1 may be "1", and the content of instruction 2 may be "0", and the specific content of instruction 1 and instruction 2 is not limited in the embodiments of the present application.

[0138] S603. The buffer allocation interface module 640 sets p buffers among the N buffers for storing camera requests to store common camera requests and q buffers to store special camera requests based on the camera mode.

[0139] The buffer allocation interface module 640 can set p buffers among the N buffers for storing camera requests to store common camera requests and q buffers to store special camera requests based on the camera mode. The values ​​of p and q may be different in different camera modes. That is, the values ​​of p and q in the photo mode may be different from the values ​​of p and q in the video recording mode.

[0140] For example, taking the value of N as 8, in the photo mode, the value of p may be 4, and the value of q may be 4. In the video mode, the value of p may be 5, and the value of q may be 3.

[0141] It is understandable that in the photo mode, the camera application will continue to send requests to obtain the preview data stream (i.e., obtain the preview image frame), and only when the user clicks the shooting control does it need to obtain the image frame at the moment the user presses the shooting control (also known as the shutter). In the video recording mode, when the user clicks the recording start control, the camera application will continue to send two types of requests, one type of request is used to obtain the preview data stream, and the other type of request is used to obtain the video data stream (i.e., video frame). In this way, in the video recording mode, in order to ensure that the camera application can run smoothly, it is necessary to reserve more buffer for ordinary camera requests. Therefore, the value of p in the video recording mode is greater than the value of p in the photo mode. The value of q in the video recording mode is less than the value of q in the photo mode.

[0142] Optionally, in a possible implementation, the camera application may not inform the allocation buffer interface module 640 of the camera mode of the camera application. The allocation buffer interface module 640 may determine the values ​​of p and q based on the camera request type received by the request queue module 620. When the request queue module 620 receives two types of camera requests, one type of request is used to obtain a preview data stream, and the other type of request is used to obtain a video data stream, the allocation buffer interface module 640 may determine that the value of p is p1 and the value of q is q1. When the request queue module 620 receives only one type of camera request for obtaining a preview data stream, the allocation buffer interface module 640 may determine that the value of p is p2 and the value of q is q2.

[0143] Exemplarily, when N is equal to 8, p1 is equal to 5, q1 is equal to 3, p2 is equal to 4, and q2 is equal to 4. The embodiment of the present application does not limit the values ​​of N, p1, q1, p2, and q2.

[0144] S604. The camera application sends multiple camera requests (camera request R11, camera request R12, ..., camera request R1m).

[0145] The camera application may send multiple camera requests (camera request R11, camera request R12, ..., camera request R1m) to the camera interface module 610. For example, the camera request R11 may be the above-mentioned Figure 3 or Figure 5 The photo request 1 is shown in FIG.

[0146] S605 . The camera interface module 610 sends the multiple camera requests (camera request R11 , camera request R12 , . . . , camera request R1m ) issued by the camera application to the request queue module 620 .

[0147] The camera interface module 610 may include a capture() interface and a setRepeatingRequest() interface. When the multiple camera requests sent by the camera application are requests for continuously obtaining a preview data stream, the camera interface module 610 may obtain the multiple camera requests sent by the camera application through the setRepeatingRequest() interface.

[0148] The camera interface module 610 may send multiple camera requests (camera request R11 , camera request R12 , . . . , camera request R1m ) issued by the camera application to the request queue module 620 .

[0149] S606a. The request queue module 620 sends multiple camera requests (camera request R11, camera request R12, . . . , camera request R1m) to the request queue processing module 630.

[0150] The request queue module 620 may send multiple camera requests (camera request R11, camera request R12, . . . , camera request R1m) to the request queue processing module 630 one by one according to the request issuance order.

[0151] Optionally, before the request queue module 620 sends the multiple camera requests to the request queue processing module 630, the request queue module 620 may also determine whether the multiple camera requests are common camera requests or special camera requests. In the case where the request queue module 620 determines that the multiple camera requests are common camera requests, the request queue module 620 may send the multiple camera requests (camera request R11, camera request R12, ..., camera request R1m) to the request queue processing module 630 one by one in the order in which the requests are issued.

[0152] Optionally, the request queue module 620 may not perform the judgment, and directly assume that the camera request sent by the camera application when it is turned on is a normal camera request.

[0153] S606b. The request queue processing module 630 allocates buffers to the buffer allocation interface module 640 for the camera request R11, the camera request R12, ..., the camera request R1p.

[0154] S606c. The camera requests R1(p+1)..., camera requests R1m in the request queue processing module 630 wait for buffer allocation.

[0155] The request queue processing module 630 can obtain buffers for multiple camera requests one by one according to the order in which the requests are issued. Since the number of buffers used to store camera requests is limited, the request queue processing module 630 obtains buffers for camera requests R11, camera requests R12, ..., camera requests R1p from the allocation buffer area interface module 640. The camera requests R1(p+1)..., camera requests R1m in the request queue processing module 630 wait for buffer allocation.

[0156] The request queue processing module 630 may include a waiting request module and a preparing HAL request module. The preparing HAL request module may obtain buffers for camera requests R11, R12, ..., and R1p from the allocating buffer area interface module 640. Camera requests R1(p+1) ... and R1m may wait for buffer allocation in the waiting request module.

[0157] S607. Allocate buffer areas: The interface module 640 allocates the camera request R11, the camera request R12, ..., the camera request R1p to p buffers.

[0158] The buffer allocation interface module 640 can allocate the camera request R11, the camera request R12, ..., the camera request R1p to p buffers one by one. Figure 5 As shown, p is 4, that is, there are 4 buffers (buffer1, buffer2, buffer3 and buffer4) in the common camera request buffer area. The buffer area allocation interface module 640 can allocate the camera request R11 to buffer1, allocate the camera request R12 to buffer2, allocate the camera request R13 to buffer3, and allocate the camera request R14 to buffer4.

[0159] Optionally, the buffer allocation interface module 640 may allocate buffers for the camera request 11, the camera request R12, ..., the camera request R1p, and return the address of the buffer for storing each camera request to the request queue processing module 630. The request queue processing module 630 may store the camera request 11, the camera request R12, ..., the camera request R1p in the buffer corresponding to each camera request according to the buffer address.

[0160] S608 . The buffer allocation interface module 640 sends a camera request R11 , a camera request R12 , . . . , a camera request R1p to the camera hardware abstraction layer 660 in sequence.

[0161] The buffer allocation interface module 640 sends the camera requests in p buffers to the camera hardware abstraction layer 660 in sequence.

[0162] In a possible implementation, the buffer allocation interface module 640 may sequentially send p buffer addresses storing camera requests R11, R12, ..., and R1p to the camera hardware abstraction layer 660. The camera hardware abstraction layer 660 may obtain camera requests one by one in the corresponding buffer according to the buffer address.

[0163] Optionally, in another possible implementation, the request queue processing module 630 also includes a batch request sending module. The buffer allocation interface module 640 can allocate buffers for camera request R11, camera request R12, ..., camera request R1p, and return the address of the buffer used to store each camera request to the request queue processing module 630. Then, the batch request sending module can send the buffer address of each camera request of camera request R11, camera request R12, ..., camera request R1p to the camera hardware abstraction layer 660. The camera hardware abstraction layer 660 can take out the camera requests from the corresponding buffer one by one according to the buffer address.

[0164] For example, Figure 5 The common camera request buffer shown in the figure has four buffers (buffer1, buffer2, buffer3 and buffer4) in the common camera request buffer. The buffer allocation interface module 640 can allocate the camera request R11 to buffer1, allocate the camera request R12 to buffer2, allocate the camera request R13 to buffer3, and allocate the camera request R14 to buffer4. The batch request sending module can send the addresses of buffer1, buffer2, buffer3 and buffer4 to the camera hardware abstraction layer 660. The camera hardware abstraction layer 660 can obtain the camera request R11 from buffer1 according to the address of buffer1. After the camera hardware abstraction layer 660 processes the camera request R11, it can obtain the camera request R12 from buffer2 according to the address of buffer2. The camera hardware abstraction layer 660 can sequentially obtain the camera requests stored in the buffer according to the buffer address.

[0165] S609. The camera hardware abstraction layer 660 obtains the image frame 1 corresponding to the camera request R11 stored in buffer1 among the p buffers through the camera.

[0166] The camera hardware abstraction layer 660 can obtain the image frame 1 corresponding to the camera request R11 stored in buffer1 of the N1 buffers through the camera. Specifically, Figure 5 As shown, the camera hardware abstraction layer 660 may include a camera request waiting module and a camera hardware abstraction processing module. The camera request to be processed may be queued in the camera request waiting module first. The camera hardware abstraction processing module may send the camera parameters in the camera request R11 being processed to the camera module through the camera driver. The camera module may obtain the image frame 1 according to the camera parameters.

[0167] The camera hardware abstraction layer 660 can send the address of buffer1 and the camera parameters to the camera module, and the image frame 1 obtained by the camera module can be stored in the buffer1. For example, the buffer1 can be Figure 5 buffer1 shown in FIG.

[0168] In a possible implementation, the camera module may send the acquired image frame 1 to the camera hardware abstraction layer 660 .

[0169] In another possible implementation, the camera module may notify the camera hardware abstraction layer 660 that the image frame 1 has been successfully acquired. After receiving the notification, the camera hardware abstraction layer 660 may acquire the image frame 1 from buffer 1.

[0170] S610 . The camera hardware abstraction layer 660 returns image frame 1 to the display service module 650 .

[0171] The camera hardware abstraction layer 660 may return the image frame 1 to the display service module 650 .

[0172] In a possible implementation, the camera hardware abstraction layer 660 may directly send the acquired image frame 1 to the display service module 650 .

[0173] Optionally, in another possible implementation, the camera hardware abstraction layer 660 may send the address of the buffer storing the image frame 1 to the display service module 650 .

[0174] S611. The display service module 650 sends image frame 1 for display.

[0175] The display service module 650 can send the image frame 1 to the display through the display driver for display. Optionally, the display service module 650 can send the address of buffer 11 corresponding to the image frame 1 to be selected to the display through the display driver, and the display can obtain the image frame from buffer 1 and send it for display.

[0176] For example, the image frame 1 may be Figure 7 The preview image 205 shown in Figure 8 A preview image 802 is shown in FIG.

[0177] In the embodiment of the present application, the buffer corresponding to the image frame may refer to the buffer storing the image frame.

[0178] S612 . The display service module 650 returns the address of buffer11 to the allocation buffer interface module 640 .

[0179] When the image frame 1 is successfully sent to the display, the display may notify the display service module 650 through the display driver. The electronic device 100 may clear the buffer 1. Then, the display service module 650 may return the address of the buffer 1 to the buffer allocation interface module 640.

[0180] S613a. The allocated buffer area interface module 640 allocates buffer1 to the camera request R1(p+1).

[0181] The buffer allocation interface module 640 may allocate buffer 1 to the camera request R1(p+1). The electronic device 100 may process multiple camera requests according to the above steps S608 to S612.

[0182] S613b. The camera requests R1(p+2)..., camera requests R1m in the request queue processing module 630 wait for buffer allocation.

[0183] After the camera request R1(p+1) is allocated to the buffer, the remaining camera requests, namely the camera request R1(p+2)..., camera request R1m can continue to wait for the allocation of buffer.

[0184] S614. The camera application detects an operation of changing the current zoom ratio of the camera.

[0185] The camera application can detect operations that change the camera's current zoom ratio, for example, Figure 2A , the user clicks on the zoom magnification control 202 to change the zoom magnification to 1x.

[0186] S615 . The camera application sends a camera request R2 to the camera interface module 610 .

[0187] The camera application may send a camera request R2 to the camera interface module 610 .

[0188] S616 . The camera interface module 610 sends the camera request R2 to the request queue module 620 .

[0189] The request queue module 620 may obtain the camera request R2 through the setRepeatingRequest() interface or the capture() interface in the camera interface module 610 .

[0190] S617. The request queue module 620 determines that the zoom factor in the camera request R2 has changed.

[0191] The request queue module 620 may determine that the zoom factor in the camera request R2 has changed. Exemplarily, the request queue processing module 620 may compare the camera request R2 with the previous camera request. If the zoom factor in the previous camera request is 0.6x and the zoom factor in the camera request R2 is 1.0x, the request queue processing module may confirm that the zoom factor in the camera request R2 has changed.

[0192] S618. The request queue module 620 requests the allocation buffer interface module 640 to obtain a buffer for the camera R2.

[0193] The request queue module 620 may directly request the buffer allocation interface module 640 to obtain the buffer for the camera R2.

[0194] S619. The buffer allocation interface module 640 allocates the camera request R2 to buffer (P+1) among the q buffers.

[0195] The buffer allocation interface module 640 may allocate the camera request R2 to buffer(P+1) among the q buffers. For example, buffer(P+1) may be Figure 5 Buffer 5 is shown in FIG. Buffer (P+1) can also be called the first buffer.

[0196] Optionally, when there is an empty buffer among the p buffers, the buffer allocation interface module 640 may also allocate the camera request R2 to an empty buffer among the p buffers.

[0197] S620. The buffer allocation interface module 640 sends the camera request R2 to the camera hardware abstraction layer 660 in sequence.

[0198] The buffer allocation interface module 640 may send the camera request R2 to the camera hardware abstraction layer 660. Step S620 may refer to the description in step S608, which will not be repeated here.

[0199] S621. The camera hardware abstraction layer 660 obtains the image frame 2 corresponding to the camera request R2 through the camera.

[0200] The camera hardware abstraction layer 660 can obtain the image frame 2 corresponding to the camera request R2 through the camera. Figure 5 As shown, the camera hardware abstraction layer 660 may include a camera request waiting module and a camera hardware abstraction processing module. The camera request to be processed may be queued in the camera request waiting module first. That is, the camera hardware abstraction layer first processes the camera requests in the p buffers issued previously, and then processes the camera request R2. The camera hardware abstraction processing module may send the camera parameters in the camera request R2 being processed to the camera module through the camera driver. The camera module may obtain the image frame 2 according to the camera parameters.

[0201] The description of step S621 may refer to step S609 and will not be repeated here.

[0202] S622 . The camera hardware abstraction layer 660 returns the image frame 2 to the display service module 650 .

[0203] The camera hardware abstraction layer 660 may return the image frame 2 to the display service module 650 .

[0204] In a possible implementation, the camera hardware abstraction layer 660 may directly send the acquired image frame 2 to the display service module 650 .

[0205] Optionally, in another possible implementation, the camera hardware abstraction layer 660 may send the address of the buffer storing the image frame 2 to the display service module 650 .

[0206] S623. The display service module 650 sends the image frame 2 for display.

[0207] The display service module 650 can send the image frame 2 to the display through the display driver for display. Optionally, the display service module 650 can send the address of the buffer 22 corresponding to the image frame 2 to be selected to the display through the display driver, and the display can obtain the image frame from the buffer 22 and send it for display.

[0208] For example, the image frame 1 may be Figure 2C The preview image 221 shown in Fig. 9 A preview image 901 is shown in FIG.

[0209] In the embodiment of the present application, the camera request R2 and the photo request 2 may be referred to as the first camera request, and the camera request R11 and the photo request 1 may be referred to as the second camera request.

[0210] It can be understood that the above steps S614-S623 are also applicable to the user performing focusing operations, exposure, adding filters and other operations in the camera application. The request queue module 620 can distinguish zoom parameters, focus parameters, exposure parameters, and filter parameters from the identifier carried in the camera request. Exemplarily, when the camera request carries the identifier android.control.zoomRatio, the request queue module 620 can determine that the identifier android.control.zoomRatio is used to indicate the zoom parameter. When the value of zoomRatio in the previous camera request of camera request R2 is 0.6x, and the value of zoomRatio in camera request R2 is 1.0x, the request queue module 620 can determine that the zoom ratio in camera request R2 has changed.

[0211] When the camera request carries the identifier android.control.aeMode, the request queue module 620 can determine that the identifier android.control.aeMode is used to indicate exposure parameters. When the camera request carries the identifier android.control.afRegions, the request queue module 620 can determine that the identifier android.control.afRegions is used to indicate focus parameters. When the camera request carries the identifier android.control.effectMode, the request queue module 620 can determine that the identifier android.control.effectMode is used to indicate filter parameters.

[0212] In implementing a camera request processing method provided in an embodiment of the present application, multiple camera requests for obtaining preview images issued when the camera is turned on are only stored in a part of the cache (for example, Figure 5 as well as Fig.10 The common camera request buffer area shown in (a) and (b) is buffer1, buffer2, buffer3, buffer4), and another part of the buffer (for example, Figure 5 as well as Fig.10 The special camera request buffers (buffer5, buffer6, buffer7, buffer8) shown in (a) and (b) are only allocated to camera requests whose first parameters (for example, zoom ratio, focus parameter, exposure parameter, filter parameter, etc.) have changed. In this way, the application framework layer can control the number of requests when the camera first sends a request according to the camera mode. Exemplarily, in the photo mode, the application framework layer can allocate only 4 buffers to camera request 1, camera request 2, camera request 3, and camera request 4 in multiple camera requests for obtaining preview images. In the video recording mode, the application framework layer can allocate only 5 buffers to camera request 1, camera request 2, camera request 3, camera request 4, and camera request 5 in multiple camera requests for obtaining preview images. The first request sent by the camera application will not fill up the bufferQueue. When the user changes the zoom ratio, or performs focus, exposure, or adds filters in the camera shooting interface, the electronic device 100 can directly allocate the camera request generated based on the user operation to the special camera request buffer area, and the application framework layer does not need to wait for a buffer to be cleared before allocating it to the buffer, and the application framework layer does not need to wait for the HAL to process the next request before allocating a buffer to the camera request. For example, Fig.10As shown in Figure (b), when the camera APK sends a zoom request, since the bufferQueue is not fully occupied by the first streaming (i.e., the first request), the camera FWK can immediately obtain an empty buffer and send it to HAL. Since FWK immediately sends a zoom request to HAL, after HAL receives the zoom request sent by FWK, it can take effect on the generated image frame as soon as possible, thereby reducing the time it takes for the electronic device 100 to respond to the user's zoom operation, that is, it can improve the tracking of the user's zoom operation and improve the user experience.

[0213] It is understandable that the user interface diagram provided in the embodiments of the present application is for reference only. Figure 1 , Figure 2A-2C ,as well as Figure 7-Figure 9 The user interface shown in the figure may include more or fewer interface elements, and the positions of the interface elements in the user interface may not be limited to the positions shown in the above figure.

[0214] Fig.11 The electronic device 100 is shown as an example. Figure 5 ,as well as Figure 6 The illustrated method for processing camera requests is a schematic diagram of the time it takes for the electronic device 100 to receive an operation from the user to change the zoom ratio, the time it takes for the electronic device 100 to send the request corresponding to the operation to the HAL layer, and the time it takes for the electronic device 100 to respond to the user operation and successfully display the image frame corresponding to the user operation when processing a zoom request.

[0215] like Fig.11 As shown in FIG. 1 (a), after the camera application of the electronic device 100 is turned on, the initial camera request (for example, Fig.11 In request 1) shown in (a), the zoom ratio can be 0.6x. Before the user changes the zoom ratio of the camera, the camera module of the electronic device 100 acquires image frames at a zoom ratio of 0.6x. After the user changes the zoom ratio of the camera to 1.0x, the sensor (e.g., touch sensor) in the screen (also referred to as a display or display screen) of the electronic device 100 can acquire the user's touch operation. After acquiring the user operation, the camera application of the electronic device 100 issues a camera request (e.g., Fig.11Request n (zoom: 1.0 (indicating that the zoom ratio is 1.0x)) is shown). Taking the number of buffers in the buffer area for storing camera requests in the electronic device 100 as 8 as an example, when buffer1-buffer4 are used to store ordinary camera requests and buffer5-buffer8 are used to store special camera requests, the time for the camera request carrying the new zoom ratio sent by the camera application in the electronic device 100 to be sent to the HAL layer through the application framework layer is z2, and the calculation formula of z2 can be as follows:

[0216] z2=x+v(Formula 3)

[0217] In the above formula 3, x is the duration of the screen sensor of the electronic device 100 detecting the user operation, and then the camera application converting the user operation into a corresponding camera request and sending it to the FWK. v is the duration of the FWK allocating a buffer for the zoom request and sending the zoom request to the HAL.

[0218] like Fig.11 As shown in FIG. 1( b ), the duration for the electronic device 100 to receive the user's zoom operation and successfully display the corresponding image frame is T2, and the calculation formula of T2 can be as follows:

[0219] T2=x+v+y21+y22+y23+y24+y25 (Formula 4)

[0220] In the above formula 4, y21 is the time length that HAL processes the request in buffer1, obtains the image frame 1101 corresponding to the request, returns the image frame 1101 to FWK, and FWK successfully displays the image frame 1101. y22 is the time length that HAL processes the request in buffer2, obtains the image frame 1102 corresponding to the request, returns the image frame 1102 to FWK, and FWK successfully displays the image frame 1102. y23 is the time length that HAL processes the request in buffer3, obtains the image frame 1103 corresponding to the request, returns the image frame 1103 to FWK, and FWK successfully displays the image frame 1103. y24 is the time length that HAL processes the request in buffer4, obtains the image frame 1104 corresponding to the request, returns the image frame 1104 to FWK, and FWK successfully displays the image frame 1104. y25 is the time length for HAL to process the zoom request, obtain the image frame 1105 corresponding to the zoom request, and return the image frame 1105 to FWK, and FWK successfully sends the image frame 1105 for display.

[0221] and Figure 4 Compared with z1 and T1 shown in Fig.11 In the embodiment, z2 is smaller than z1, and T2 is smaller than T1. Figure 5 ,as well as Figure 6 When the camera request processing method shown processes a zoom request, the time from when the electronic device 100 receives the user's operation to change the zoom ratio to when the electronic device 100 sends the request corresponding to the operation to the HAL layer, and the time required for the electronic device 100 to respond to the user operation and successfully send the image frame corresponding to the user operation are reduced. A camera request processing method provided in an embodiment of the present application is implemented. When the camera APK sends a zoom request, since the bufferQueue is not fully occupied by the first stream (i.e., the first request sent), the camera FWK can immediately obtain an empty buffer and send it to HAL. Since the FWK immediately sends the zoom request to HAL, after HAL receives the zoom request sent by the FWK, it can take effect on the generated image frame as soon as possible, thereby reducing the time it takes for the electronic device 100 to respond to the user's zoom operation, that is, the tracking of the user's zoom operation can be improved, and the user experience can be improved.

[0222] An exemplary electronic device 100 provided in an embodiment of the present application is introduced below.

[0223] Fig.12 It is a schematic diagram of the structure of the electronic device 100 provided in an embodiment of the present application.

[0224] The embodiment is described in detail below by taking the electronic device 100 as an example. It should be understood that the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0225] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light 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.

[0226] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0227] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0228] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0229] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0230] In some embodiments, the processor 110 may include one or more interfaces. The interface 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.

[0231] 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 groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0232] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0233] 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 a 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 to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0234] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally 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 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0235] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0236] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the 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.

[0237] The SIM interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.

[0238] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0239] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0240] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.

[0241] The power management module 141 is used to connect 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 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

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

[0243] 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 a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0244] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0245] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate 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 the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0246] The wireless communication module 160 can provide wireless communication solutions 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), infrared (IR), etc., which are applied to the electronic device 100. 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 the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0247] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through 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 technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0248] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0249] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0250] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0251] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0252] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0253] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0254] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0255] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0256] The external memory 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 memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0257] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, applications required for at least one function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as face information template data, fingerprint information template, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0258] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0259] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0260] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0261] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0262] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0263] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0264] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0265] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

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

[0267] 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 leather case. 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 according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.

[0268] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0269] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0270] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a 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 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0271] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived 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 cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0272] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0273] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0274] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass 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 the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0275] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0276] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0277] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.

[0278] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.

[0279] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0280] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0281] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0282] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A camera request processing method, characterized in that: The method is applied to an electronic device having a camera module, and the method comprises: Detecting the user's operation of changing the camera parameters, sending a first camera request; Determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, allocating the first camera request to a first cache buffer in a first cache area, wherein a storage area in the electronic device for storing camera requests is divided into the first cache area and a second cache area, the first cache area is used to store the first camera request, the camera parameters include one or more of a zoom ratio, a focus parameter, an exposure parameter, and a filter parameter, and the second camera request is a camera request obtained by the electronic device before obtaining the first camera request; Acquire a first image frame according to the camera parameters in the first camera request; The first image frame is displayed.

2. The method according to claim 1, characterized in that The first buffer area includes q buffers, the second buffer area includes p buffers, and the method further includes: The values ​​of q and p are determined based on a camera mode of a camera application in the electronic device.

3. The method according to claim 2, characterized in that The determining the values ​​of q and p based on the camera mode of the camera application in the electronic device includes: When the camera mode of the camera application is a photo mode, determining that the value of q is a first value and the value of p is a second value; When the camera mode of the camera application is the video recording mode, the value of q is determined to be a third value, the value of p is determined to be a fourth value, the sum of the third value and the fourth value is a fifth value, the sum of the first value and the second value is a sixth value, and the fifth value is equal to the sixth value.

4. The method according to any one of claims 1 to 3, characterized in that: Before the detection of the user changing the camera parameters and sending the first camera request, the method further includes: The electronic device detects an operation of starting the camera application and starts the camera application; The camera application in the electronic device sends a plurality of camera requests, wherein the plurality of camera requests include the second camera request; When there is an empty buffer in the second buffer area, allocating the second camera request to a second buffer, where the second buffer is an empty buffer in the second buffer area; When there is no empty buffer in the second buffer area, the electronic device waits for the second buffer in the second buffer area to be cleared and then allocates the second camera request to the second buffer.

5. The method according to claim 1, characterized in that After determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, the method further includes: When there is an empty buffer in the second buffer area, the first camera request is allocated to a second buffer in the second buffer area, and the second buffer is an empty buffer.

6. The method according to claim 5, characterized in that The operation of the user changing the first camera parameter is an operation of the user changing the zoom ratio, and the method further includes: The camera application displays a first preview interface, the first preview interface displays the second image frame, and the zoom ratio corresponding to the second image frame is a first zoom ratio; The camera detects a user's operation of changing the zoom ratio and displays a second preview interface, in which the first image frame is displayed. The zoom ratio corresponding to the first image frame is a second zoom ratio.

7. The method according to any one of claims 1 to 6, characterized in that: The electronic device comprises a request module, a cache module, The determining that the camera parameters in the first camera request are different from the camera parameters in the second camera request, and allocating the first camera request to a first cache buffer in a first cache area, includes: The request module determines that camera parameters in the first camera request are different from camera parameters in the second camera request; The request module sends the first camera request to the cache module; The cache module allocates the first camera request to a first cache buffer in a first cache area.

8. The method according to claim 7, characterized in that The electronic device further includes a camera processing module. After the cache module allocates the first camera request to a first cache buffer in the first cache area, the method further includes: The cache module sends the first camera request to the camera processing module; Acquiring a first image frame according to the camera parameters in the first camera request includes: The camera processing module sends the camera parameters in the first camera request to the camera module; The camera module obtains a first image frame according to the camera parameters in the first camera request.

9. The method according to claim 4, characterized in that The electronic device further includes a cache module and a camera processing module. After allocating the second camera request to the second buffer, the method further includes: The cache module sends the second camera request to the camera processing module.

10. The method according to claim 9, characterized in that The electronic device further includes a camera application and a display module. After the cache module sends the second camera request to the camera processing module, the method further includes: The camera processing module sends the camera parameters in the second camera request to the camera module, and obtains a second image frame obtained by the camera module according to the camera parameters in the second camera request; The camera processing module sends the second image frame to the display module; The display module displays the second image frame; The camera application displays the second image frame.

11. An electronic device, characterized in that: It comprises a camera, one or more processors and one or more memories; wherein the camera, the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the method as described in any one of claims 1-10 is executed.

12. A chip system, the chip system is applied to electronic equipment, the chip system comprises one or more processors, characterized in that: The processor is configured to call computer instructions so as to execute the method according to any one of claims 1 to 10.

13. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the method according to any one of claims 1 to 10 is executed.

Citation Information

Patent Citations

  • Camera mode control

    CN107534774A

  • Cache queue allocation method and device for camera and storage medium

    CN112312023A

  • Photographing method and electronic equipment

    CN116055857A

  • Image processing method and device and storage medium

    CN116389898A

  • Combining effective images in electronic device having a plurality of cameras

    US20140232904A1