Camera control method and electronic device
By providing multiple configuration parameter groups for the mobile phone camera and selecting the appropriate parameter group to start the camera sensor, the problem of taking into account both the function and speed of the mobile phone camera is solved, and the functional and speed requirements in different scenarios are achieved.
Patent Information
- Application Number
- CN202311558240.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2043-11-20
AI Technical Summary
Due to the large number of registers configured for mobile phone cameras, the camera function is slow to open, and it cannot take into account both the camera function and the opening speed, which cannot meet the user's multiple usage needs.
Provide a camera control method, by providing a camera sensor with a plurality of configuration parameter groups, including a first configuration parameter group and a second configuration parameter group, selecting an appropriate parameter group according to user operations, and the first configuration parameter group is used for Achieving high functionality, the second configuration parameter group is used to quickly turn on the camera.
In some scenarios, the functionality of the mobile phone camera is improved, and in other scenarios, the camera is opened to meet the user's various usage needs.
Smart Images

Figure CN117979147B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a camera control method and electronic device. Background Art
[0002] In order to make the camera function of the mobile phone more in line with user needs (for example, high pixels, a variety of camera functions), the mobile phone in the relevant solution configures a large number of registers for the camera sensor. In response to the user input for turning on the camera function, the mobile phone needs to write register configuration parameters to the camera sensor before controlling the camera sensor to start collecting images. Since the number of registers configured by the mobile phone for the camera sensor is large (for example, 10,000 registers), it takes a long time for the mobile phone to write register configuration parameters to the camera sensor, which in turn leads to a long time from the user inputting the operation to the camera sensor starting to collect images, resulting in a visual effect that the mobile phone camera opens slowly.
[0003] In summary, the above-mentioned related solutions have the problem that the camera function of the mobile phone camera and the opening speed of the mobile phone camera restrict each other, and cannot meet the user's various usage needs for the mobile phone camera. Summary of the invention
[0004] The embodiments of the present application provide a camera control method and an electronic device for improving the camera function of a mobile phone camera in some scenarios and increasing the opening speed of the mobile phone camera in other scenarios, so as to meet the user's various usage requirements for the mobile phone camera.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In the first aspect, a camera control method is provided, which is applied to an electronic device including a camera sensor, the electronic device including a first application (Application, APP) and a second APP, and the method may include: receiving a first operation input by a user for starting a camera function of the first APP; then, in response to the first operation, determining a first configuration parameter group from multiple configuration parameter groups; the first configuration parameter group includes multiple register configuration parameters, and the register configuration parameters are used to configure the camera sensor; then starting the camera sensor according to the first configuration parameter group, and displaying the first camera interface. Secondly, a second operation input by a user for starting a camera function of a second APP may also be received; then, in response to the second operation, determining a second configuration parameter group from multiple configuration parameter groups; then starting the camera sensor using the second configuration parameter group, and displaying a second camera interface.
[0007] The number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group.
[0008] It is understandable that the electronic device can provide multiple configuration parameter groups for the camera sensor, which may include a first configuration parameter group and a second configuration parameter group, and the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group. In this solution, the electronic device responds to the first operation of starting the camera function of the first APP and uses the first configuration parameter group to start the camera sensor. Since the first configuration parameter group includes more register configuration parameters than the second configuration parameter group, starting the camera sensor using the first configuration parameter group can achieve camera functions that better meet user needs, such as higher shooting pixels, more types of camera functions, and so on.
[0009] Secondly, in response to the second operation of starting the camera function of the second APP, the electronic device starts the camera sensor using the second configuration parameter group. Since the second configuration parameter group includes fewer register configuration parameters than the first configuration parameter group, the time for writing data to the camera sensor can be shortened when starting the camera sensor using the second configuration parameter group, thereby shortening the startup time of the camera sensor and realizing quick opening of the camera.
[0010] In summary, the present solution is used to improve the camera function of a mobile phone camera in some scenarios, and to improve the opening speed of a mobile phone camera in other scenarios, thereby meeting various usage requirements of users for mobile phone cameras.
[0011] In conjunction with the first aspect, in a possible implementation, the first APP and the second APP are the same, the camera function of the first APP is a shooting function, and the camera function of the second APP is a code scanning function. The first configuration parameter group includes: register configuration parameters associated with the shooting function. The second configuration parameter group includes register configuration parameters associated with the code scanning function.
[0012] This implementation describes a first example of a scenario in which the first configuration parameter group and the second configuration parameter group are applied respectively. Specifically, for the same APP, the first configuration parameter group is used to start the camera sensor when the shooting function of the APP is started, and the second configuration parameter group is used to start the camera sensor when the code scanning function of the APP is started. Generally speaking, when the user starts the shooting function, he pays more attention to the camera function of the camera. At this time, starting the camera sensor with the first configuration parameter group can meet the user's high demand for the camera function. When the user starts the code scanning function, he pays more attention to the opening speed of the camera. At this time, starting the camera sensor with the second configuration parameter group can meet the user's demand for a faster camera opening speed.
[0013] In combination with the first aspect, in another possible implementation manner, the first APP and the second APP are system camera APPs or third-party APPs.
[0014] It is understandable that, no matter whether the first operation starts the system camera APP or the third-party APP, the electronic device uses the first configuration parameter group to start the camera sensor when starting the shooting function, and uses the second configuration parameter group to start the camera sensor when starting the code scanning function. In this way, the electronic device can provide the system camera APP and the third-party APP with a more powerful camera function in the shooting scene and a faster camera opening speed in the code scanning scene.
[0015] In combination with the first aspect, in another possible implementation, the camera function of the first APP is the shooting function of the system camera APP, and the camera function of the second APP is the code scanning function of the third-party APP. The first configuration parameter group includes: register configuration parameters associated with the shooting function of the system camera APP. The second configuration parameter group includes register configuration parameters associated with the code scanning function of the third-party APP.
[0016] This implementation describes a second example of a scenario in which the first configuration parameter group and the second configuration parameter group are applied respectively. Specifically, since the user is more concerned about the camera function when starting the shooting function of the system camera APP, at this time, starting the camera sensor using the first configuration parameter group can meet the user's high demand for the camera function. When the user starts the code scanning function of the third-party APP, he is more concerned about the camera opening speed. At this time, starting the camera sensor using the second configuration parameter group can meet the user's demand for a faster camera opening speed.
[0017] In combination with the first aspect, in another possible implementation, the camera function of the first APP is the shooting function of the system camera APP, and the camera function of the second APP is the shooting function of the third-party APP. The first configuration parameter group includes: register configuration parameters associated with the shooting function of the system camera APP. The second configuration parameter group includes register configuration parameters associated with the shooting function of the third-party APP.
[0018] This implementation describes a third example of a scenario in which the first configuration parameter group and the second configuration parameter group are applied respectively. Secondly, the electronic device uses the first configuration parameter group to start the camera sensor when starting the shooting function of the system camera APP, and uses the second configuration parameter group to start the camera sensor when starting the shooting function of the third-party APP. Since the camera function that better meets the user's needs can be achieved by starting the camera sensor using the first configuration parameter group, it can be known that the shooting functions provided by the system camera APP and the third-party APP are also different, and the shooting function provided by the system camera APP is better than the shooting function provided by the third-party APP.
[0019] For example, a high-pixel shooting function provided by a system camera APP in an electronic device, and a low-pixel shooting function provided by a third-party APP in the electronic device; at this time, the number of register configuration parameters associated with the shooting function of the system camera APP is greater than the number of register configuration parameters associated with the shooting function of the third-party APP.
[0020] In combination with the first aspect, in another possible implementation, the first camera interface includes at least one target function control, and the second camera interface does not include at least one target function control; wherein the at least one target function control includes: a function control for triggering a face shooting function, and a function control for triggering a digital zoom function.
[0021] It can be understood that in addition to the different pixel heights of the shooting functions provided by the system camera APP and the third-party APP, the implementation method describes another example of the difference between the shooting functions provided by the system camera APP and the third-party APP, that is, when using the shooting function provided by the system camera APP, the electronic device provides the user with an operable target function control for the user to adjust the shooting function provided by the system camera APP, for example, adjusting the image effect of the shooting function by using the function control for triggering the face shooting function, and adjusting the shooting angle and the size of the shooting screen of the shooting function by using the function control for triggering the digital zoom function.
[0022] Secondly, since the first camera interface includes at least one target function control, and the second camera interface does not include at least one target function control, it can be known that the first configuration parameter group includes register configuration parameters related to at least one target function control, and the second configuration parameter group does not include register configuration parameters related to at least one target function control. It can be further known that compared with the first configuration parameter group, the number of register configuration parameters included in the second configuration parameter group is greatly reduced. Therefore, the electronic device uses the second configuration parameter group to start the camera sensor faster, so that the second camera interface of the electronic device can be quickly opened.
[0023] In combination with the first aspect, in another possible implementation, before determining the first configuration parameter group from the plurality of configuration parameter groups, the method further includes: in response to the first operation, updating the value of the preset identifier based on the camera function of the first application APP. The preset identifier includes at least one of the following: a first identifier corresponding to each APP category in at least one APP category, and a second identifier corresponding to each camera function category in at least one camera function category; at least one APP category includes a system camera APP and a third-party APP; at least one camera function category includes a shooting function and a code scanning function.
[0024] The step of determining the first configuration parameter group from the plurality of configuration parameter groups includes: determining the first configuration parameter group from the plurality of configuration parameter groups based on a value of a preset identifier.
[0025] This implementation describes that the electronic device responds to a first operation for starting a camera function of a first application, and can determine the register configuration parameters for starting a camera sensor based on the APP category of the first application APP and / or the camera function category of the camera function of the first application APP. It can be understood that the APP category and camera function category started by the user will affect the user's demand for the camera. Therefore, if the APP category of the first application APP and / or the camera function category of the camera function of the first application APP indicate that the user has a high requirement for the camera function of the camera, the electronic device determines to start the camera sensor using the first configuration parameter group, so that the user's demand for the camera can be met with a high probability.
[0026] In combination with the first aspect, in another possible implementation, the preset identifier includes a first identifier corresponding to the system camera APP and a second identifier corresponding to the code scanning function. The above-mentioned determining the first configuration parameter group from multiple configuration parameter groups based on the value of the preset identifier includes: if the value of the first identifier corresponding to the system camera APP indicates that the first APP is the system camera APP, and the value of the second identifier corresponding to the code scanning function indicates that the camera function of the first APP is not the code scanning function, then determining the first configuration parameter group from multiple configuration parameter groups.
[0027] It is understandable that if the first APP is a system camera APP and the camera function of the first APP is not a code scanning function, it means that the camera function of the first APP is the shooting function of the system camera APP. When the user starts the shooting function of the system camera APP, the camera function of the camera is usually required to be high. At this time, the electronic device determines that starting the camera sensor using the first configuration parameter group can meet the user's high demand for camera functions.
[0028] In combination with the first aspect, in another possible implementation, the method also includes: receiving a third operation input by the user for turning off the camera function of the first APP; in response to the third operation, updating the value of the preset identifier so that the updated value of the preset identifier is equal to the initial value of the preset identifier; and displaying the camera closing interface.
[0029] It is understandable that the electronic device continues to update the value of the preset identifier when the camera function of the first APP is turned off, so that the value of the preset identifier is restored to the initial value. In this way, it can be avoided that the value of the preset identifier updated when the camera function of the first APP is started this time affects the register configuration parameters for starting the camera sensor next time.
[0030] In a second aspect, an electronic device is provided, the electronic device comprising: a processor, a memory, and a communication interface. The memory and the communication interface are coupled to the processor, the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes the camera control method as described in any one of the first aspects above.
[0031] In a third aspect, a computer-readable storage medium is provided, wherein computer instructions are stored in the computer-readable storage medium. When the computer instructions are executed on an electronic device, the electronic device executes the camera control method as described in any one of the first aspects.
[0032] In a fourth aspect, a computer program product including computer instructions is provided. When the computer instructions are executed on an electronic device, the electronic device executes the camera control method as described in any one of the first aspects above.
[0033] Among them, the technical effects brought about by any design method in the second to fourth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A software structure diagram of a mobile phone provided in an embodiment of the present application;
[0035] Figure 2 A camera control method according to an embodiment of the present invention Figure 1 ;
[0036] Figure 3 A schematic diagram of a camera control interface provided in an embodiment of the present application Figure 1 ;
[0037] Figure 4 A schematic diagram of a camera control interface provided in an embodiment of the present application Figure 2 ;
[0038] Figure 5 A schematic diagram of a camera control interface provided in an embodiment of the present application Figure 3 ;
[0039] Figure 6 A schematic diagram of a process for updating a value of a preset identifier provided in an embodiment of the present application;
[0040] Figure 7 A camera control method according to an embodiment of the present invention Figure 2 ;
[0041] Figure 8 A camera control method according to an embodiment of the present invention Figure 3 ;
[0042] Fig. 9 A flowchart of an asynchronous thread for writing data provided in an embodiment of the present application;
[0043] Fig.10 A camera control method according to an embodiment of the present invention Figure 4 ;
[0044] Fig.11 A schematic diagram of the structure of a camera control device provided in an embodiment of the present application;
[0045] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0046] Fig.13 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating 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. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0049] At present, using the related solutions described in the above background technology, the mobile phone configures a large number of registers for the camera sensor so that the mobile phone camera can realize the camera function that better meets the user's needs, but it also causes the mobile phone camera to open slowly. In some scenarios where the mobile phone camera is required to open quickly, for example, the scenario where the user triggers the scanning function of any application in the mobile phone, and the scenario where the user triggers the camera function of any third-party application in the mobile phone, the above related solutions cannot meet the user's demand for the use of the mobile phone camera.
[0050] In summary, the above-mentioned related solutions have the problem of being unable to take into account both the camera functions and the opening speed of the mobile phone camera at the same time, and are unable to meet the user's various usage requirements for the mobile phone camera.
[0051] In view of the above problems, an embodiment of the present application provides a camera control method, where an electronic device can provide multiple configuration parameter groups for a camera sensor, which can include a first configuration parameter group and a second configuration parameter group, and the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group. In this solution, the electronic device uses the first configuration parameter group to start the camera sensor in response to a first operation of starting a camera function of a first application. Since the first configuration parameter group includes more register configuration parameters than the second configuration parameter group, starting the camera sensor using the first configuration parameter group can achieve camera functions that better meet user needs, such as higher shooting pixels, more types of camera functions, and so on.
[0052] Secondly, in response to the second operation of starting the camera function of the second application, the electronic device starts the camera sensor using the second configuration parameter group. Since the second configuration parameter group includes fewer register configuration parameters than the first configuration parameter group, the time for writing data to the camera sensor can be shortened when starting the camera sensor using the second configuration parameter group, thereby shortening the startup time of the camera sensor and realizing quick opening of the camera.
[0053] In summary, the present solution is used to improve the camera function of a mobile phone camera in some scenarios, and to improve the opening speed of a mobile phone camera in other scenarios, thereby meeting various usage requirements of users for mobile phone cameras.
[0054] The camera control method provided in the embodiment of the present application can be applied to electronic devices including camera sensors such as mobile phones, tablet computers, and laptop computers, and the embodiment of the present application does not impose any restrictions on this. The following takes a mobile phone as an example to introduce the camera control method provided in the embodiment of the present application.
[0055] For example, taking a mobile phone as an example, the software structure diagram of the mobile phone provided in the embodiment of the present application is introduced. Figure 1 As shown, the software system of the mobile phone can be a layered architecture Android TM System. Layered architecture divides software into several layers, each with clear roles and division of labor. Layers communicate with each other through software interfaces. In some examples, Android TM The system is divided into five layers, from top to bottom: application layer, application framework layer (or framework layer Framework), system library and Android runtime (android runtime), HAL layer (hardware abstraction layer), and driver layer (or kernel layer).
[0056] The application layer can include a series of apps. This series of apps can be divided into system apps that come with the phone and third-party apps that users download to the phone. For example, Figure 1 As shown, the system APP may include the system camera APP, etc.; the third-party APP may include: chat APP, shopping APP, etc.
[0057] The framework layer provides an application programming interface (API) and a programming framework for the APP in the application layer. The application framework layer includes some predefined functions. For example, the application framework layer may include a window manager, a content provider, a view system, a resource manager, etc., and the embodiments of the present application do not impose any restrictions on this.
[0058] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0059] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0060] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build the display interface of an application. The display interface can be composed of one or more views. For example, a camera interface includes images captured by a camera sensor.
[0061] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0062] In the embodiment of the present application, the framework layer may further include a camera service, etc. The camera service is used to call the sensor driver in the driver layer to implement a startup task or a shutdown task for the camera sensor.
[0063] The system library can include multiple functional modules. For example: surface manager, OpenGLES, SGL, etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. OpenGL ES is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing. SGL is a drawing engine for 2D drawing.
[0064] The Android runtime includes the core library and the ART virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the framework layer run in the ART virtual machine. The ART virtual machine executes the Java files of the application layer and the application framework layer as binary files. The ART virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0065] The HAL layer is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. The HAL layer provides a standard interface to display device hardware functions to the higher-level Java API framework (i.e., the framework layer). The HAL layer contains multiple library modules, each of which implements an interface for a specific type of hardware component, such as a camera sensor module. The camera sensor module can be implemented by a provider process in the HAL (or camera sensor HAL).
[0066] The kernel layer is the layer between hardware and software. The kernel layer at least includes display driver, camera sensor driver, etc., which are not limited in this application.
[0067] Based on the above hardware architecture and software architecture, the control method provided in the embodiment of the present application is introduced below by taking the electronic device as a mobile phone as an example.
[0068] In an embodiment of the present application, a mobile phone may provide a plurality of configuration parameter groups for a camera sensor, each configuration parameter group (or referred to as initialization setting data init settings) may include one or more register configuration parameters, and each register configuration parameter may include the address of a register and the value stored in the register. For example, the plurality of configuration parameter groups may include a first configuration parameter group (or referred to as a first group init settings) and a second configuration parameter group (or referred to as a second group init settings). The first configuration parameter group may include all register configuration parameters configured by the mobile phone for the camera sensor. The second configuration parameter group may include some register configuration parameters configured by the mobile phone for the camera sensor.
[0069] Among them, all register configuration parameters configured by the mobile phone for the camera sensor can be used to implement the first camera function, and the first camera function may include: a first shooting function (for example, a high-pixel shooting function), a face shooting function, a digital zoom (DigitalZoom) function, and a code scanning function, etc. Since the first configuration parameter group includes register configuration parameters for implementing the first camera function (for example, register configuration parameters for implementing the high-pixel shooting function (or called HwRemosaic configuration parameters), register configuration parameters for implementing digital zoom (or called insensorzoomseamless configuration parameters)), therefore, the mobile phone uses the first configuration parameter group to start the camera sensor, and can provide the user with the first camera function, such as a high-pixel shooting function and a digital zoom shooting function, thereby realizing a camera function that better meets the user's needs.
[0070] Secondly, some register configurations in the second configuration parameter group can be used to implement the second camera function, which can include: a second shooting function and a code scanning function. Since the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group, it can be further known that when the mobile phone uses the second configuration parameter group to start the camera sensor, the startup time of the camera sensor can be shortened, thereby realizing quick opening of the camera.
[0071] Furthermore, the mobile phone can divide the scenarios for using the mobile phone camera, for example, into a first scenario that has high requirements for the camera function of the mobile phone camera and a second scenario that has high requirements for the opening speed of the mobile phone camera. In the first scenario that has high requirements for the camera function of the mobile phone camera, the mobile phone can use the first configuration parameter group to start the camera sensor to achieve a more powerful camera function. In the second scenario that has high requirements for the opening speed of the mobile phone camera, the mobile phone can use the second configuration parameter group to start the camera sensor to achieve fast opening of the camera.
[0072] It should be noted that the first shooting function, face shooting function, digital zoom function and code scanning function can all belong to the camera functions provided by the system camera APP in the mobile phone. In other words, the first camera function can include all camera functions provided by the system camera APP in the mobile phone.
[0073] Secondly, the first shooting function in the first camera function can be called the shooting function of the system camera APP, and the second shooting function in the second camera function can be called the shooting function of the third-party APP. The first shooting function and the second shooting function can be the same or different. For example, the first shooting function and the second shooting function are different, the first shooting function is a high-pixel shooting function, and the second shooting function is a low-pixel shooting function. For another example, the first shooting function and the second shooting function are the same, and the first shooting function and the second shooting function are both high-pixel shooting functions.
[0074] For example, in combination Figure 1 The camera control method provided by the embodiment of the present application is introduced by taking the first scenario including the shooting function of the system camera APP in the mobile phone. The second scenario including the scanning function of the system camera APP in the mobile phone and the camera function (including the shooting function and the scanning function) of any third-party APP in the mobile phone as an example. Specifically, Figure 2 As shown, the method may include S201-S209.
[0075] S201. The mobile phone receives a start operation input by a user for starting a camera function of a target APP.
[0076] The mobile phone can receive the start operation through the touch screen of the mobile phone. The target APP in the mobile phone can be a system camera APP in the mobile phone, or any third-party APP that provides a camera function in the mobile phone, etc. The camera function can be a shooting function, a code scanning function, etc.
[0077] It should be noted that when the mobile phone uses the shooting function, it can capture images of the subject. When the mobile phone uses the code scanning function, it only scans the subject and does not capture images.
[0078] It should also be noted that the target APP can be the first APP or the second APP. When the target APP is the first APP, the start operation is the first operation. When the target APP is the second APP, the start operation is the second operation.
[0079] For example, if the camera function of the target APP is the shooting function of the system camera APP, Figure 3 As shown in (a) of FIG. 1 , the mobile phone displays a desktop interface 310, and the desktop interface 310 includes an icon 311 of the system camera APP. The mobile phone can receive a click operation of the icon 311 input by the user on the desktop interface 310. The click operation of the icon 311 can be a start operation for starting the shooting function of the system camera APP.
[0080] For example, if the camera function of the target APP is the code scanning function of the system camera APP, Figure 3 As shown in (b) of FIG. 1 , the mobile phone displays a shooting interface 320 of the system camera APP, and the shooting interface 320 may include an icon 321 corresponding to the code scanning function. The mobile phone may receive a user's click operation on the icon 321. The click operation on the icon 321 may be a start operation for starting the code scanning function of the system camera APP.
[0081] For example, the camera function of the target APP is a shooting function of any third-party APP in the mobile phone, such as Figure 4 As shown in (a) of FIG. 1 , the mobile phone displays the first interface 410 of the third-party APP, and the first interface 410 includes an icon 411 corresponding to the shooting function. The mobile phone can receive a user's click operation on the icon 411. The click operation on the icon 411 can be a start operation for starting the shooting function of the third-party APP.
[0082] For example, the camera function of the target APP is a code scanning function of any third-party APP in the mobile phone, such as Figure 5 As shown in (a) of FIG. 1 , the mobile phone displays the first interface 510 of the third-party APP, and the first interface 510 includes an icon 511 corresponding to the code scanning function. The mobile phone can receive a user's click operation on the icon 511. The click operation on the icon 511 can be a start operation for starting the code scanning function of the third-party APP.
[0083] S202. The target APP generates a first instruction in response to the startup operation, and sends the first instruction to the camera sensor HAL; wherein the first instruction includes multiple parameters, and the multiple parameters are used to characterize the application category of the target APP and the function category of the camera function started by the startup operation.
[0084] In response to the startup operation, the target APP in the mobile phone can generate a first instruction and then start the camera sensor. The application category of the target APP can be a system camera APP or a third-party APP. The category of the camera function started by the startup operation can be a shooting function or a code scanning function. The target APP can communicate with the camera sensor HAL through the camera server.
[0085] Exemplarily, the target APP can send a first instruction to the camera sensor HAL in the HAL by calling postcamera. The multiple parameters in the first instruction may include: parameter cmd, parameter param1 and parameter param2. The parameter cmd can be used to characterize the application category of the target APP. The parameter param2 can be used to characterize the category of the camera function started by the startup operation. For example, when the startup operation is used to trigger the shooting function of starting the system camera APP, the values of the multiple parameters in the first instruction may include: parameter cmd=0x21, parameter param1=2, parameter param2=0. For another example, when the startup operation is used to trigger the scanning function of starting the system camera APP, the values of the multiple parameters in the first instruction may include: parameter cmd=0x21, parameter param1=0, parameter param2=1.
[0086] S203. The camera sensor HAL updates and saves the value of a preset identifier based on the values of multiple parameters in the first instruction; the preset identifier includes a first identifier corresponding to the system camera APP and a second identifier corresponding to the code scanning function.
[0087] The preset identifier and the initial value of the preset identifier can be pre-saved in the mobile phone. After receiving the first instruction, the mobile phone camera sensor HAL can update the value of the first identifier flag1 in the preset identifier and / or update the value of the second identifier flag2 in the preset identifier based on the values of multiple parameters in the first instruction, and save the updated value of the preset identifier.
[0088] Exemplarily, the initial value of the first flag flag1 and the initial value of the second flag flag2 may both be 0.
[0089] Exemplarily, the camera sensor HAL may parse the first instruction by calling the cfgserver interface to obtain the values of multiple parameters in the first instruction.
[0090] In some embodiments, if the numerical values of the multiple parameters in the first instruction represent that the application category of the target APP is the system camera APP, the camera sensor HAL may update the numerical value of the first identifier flag1; if the numerical values of the multiple parameters in the first instruction represent that the application category of the target APP is a third-party APP, the camera sensor HAL may not update the numerical value of the first identifier flag1. If the numerical values of the multiple parameters in the first instruction represent that the functional category of the camera function started by the startup operation is the code scanning function, the camera sensor HAL may update the numerical value of the second identifier flag2; if the numerical values of the multiple parameters in the first instruction represent that the functional category of the camera function started by the startup operation is the shooting function, the camera sensor HAL may not update the numerical value of the second identifier flag2.
[0091] For example, the process of updating the value of the preset identifier by the mobile phone is described by taking the preset identifier including the first identifier corresponding to the system camera APP and the second identifier corresponding to the code scanning function as an example. Figure 6 As shown, the mobile phone updates the value of the preset identifier based on the values of multiple parameters in the first instruction, which may include: judging whether the application category of the target APP is the system camera APP according to the values of multiple parameters in the first instruction; if the application category of the target APP is not the system camera APP, the camera sensor HAL does not process the value of the first identifier flag1, and ends updating the value of the preset identifier; if the application category of the target APP is the system camera APP, the camera sensor HAL may update the value of the first identifier flag1 corresponding to the system camera APP to be equal to the value of the parameter param1; then, judging whether the function category of the camera function activated by the startup operation is the code scanning function according to the values of multiple parameters in the first instruction; if the function category of the camera function activated by the startup operation is the code scanning function, the camera sensor HAL may update the value of the second identifier flag2 corresponding to the code scanning function to be equal to the value of the parameter param2; if the function category of the camera function activated by the startup operation is not the code scanning function, the camera sensor HAL does not process the value of the second identifier flag2, and ends updating the value of the preset identifier.
[0092] Optionally, the preset identifier may further include a third identifier flag3 corresponding to the third-party APP. If the values of the multiple parameters in the first instruction indicate that the application category of the target APP is a third-party APP, the camera sensor HAL may modify the value of the third identifier flag3.
[0093] S204: The camera sensor HAL determines whether the target APP is a system camera APP based on the value of the preset identifier.
[0094] The camera sensor HAL can determine whether the first application is a system camera APP according to the value of the first identifier flag1 corresponding to the system camera APP in the preset identifier. If the target APP is the system camera APP, the camera sensor HAL can execute S205 to determine whether the start operation starts the shooting function or the code scanning function of the system camera APP. If the target APP is not the system camera APP, the camera sensor HAL can execute S207 to determine whether a second configuration parameter group with fewer register configuration parameters can be used.
[0095] For example, taking the value of the first identifier flag1 corresponding to the system camera APP as 0 or 2, if the value of the first identifier flag1 is equal to 0, the camera sensor HAL can determine that the target APP is not the system camera APP. If the value of the first identifier flag1 is equal to 2, the camera sensor HAL can determine that the target APP is the system camera APP.
[0096] S205: The camera sensor HAL determines whether the camera function started by the start operation is a shooting function based on the value of the preset identifier.
[0097] After the camera sensor HAL determines that the target APP is the system camera APP, it can determine whether the start-up operation starts the shooting function or the scanning function according to the value of the second identifier flag2 corresponding to the scanning function in the preset identifier. If the start-up operation starts the shooting function, the camera sensor HAL can execute S206 to use the register configuration parameters related to the first camera function (i.e., the first configuration parameter group). If the start-up operation starts the scanning function, the camera sensor HAL can execute S207 to determine whether the second configuration parameter group with fewer register configuration parameters can be used.
[0098] For example, taking the value of the second identifier flag2 corresponding to the code scanning function as 0 or 1 as an example, if the value of the second identifier flag2 is equal to 0, the camera sensor HAL can determine that the start operation does not start the code scanning function, and determines that the start operation starts the shooting function. If the value of the second identifier flag2 is equal to 1, the camera sensor HAL can determine that the start operation starts the code scanning function.
[0099] S206: The camera sensor HAL uses the first configuration parameter group to control the camera sensor driver to start the camera sensor.
[0100] If the startup operation does not start the scanning function of the system camera APP (or the startup operation starts the shooting function of the system camera APP), the camera sensor HAL can use the first configuration parameter group to start the camera sensor.
[0101] In some embodiments, the camera sensor HAL uses the first configuration parameter group to control the camera sensor driver to start the camera sensor, which may include: the camera sensor HAL may send the first configuration parameter group to the camera sensor driver; the camera sensor driver may write the first configuration parameter group into the camera sensor.
[0102] It can be understood that in the first scenario where the startup operation is used to start the shooting function of the system camera APP, the mobile phone uses the first configuration parameter group to start the camera sensor. Since the first configuration parameter group can include register configuration parameters related to the first camera function (for example, high-pixel shooting function, face shooting function), it can be seen that the mobile phone uses the first configuration parameter group to start the camera sensor, which can provide users with high-pixel shooting functions and face shooting functions, etc., thereby realizing a camera function that better meets user needs. In the first scenario of starting the shooting function of the system camera APP, the mobile phone camera improves the camera function, which can meet the user's demand for higher camera functions in the first scenario.
[0103] S207: The camera sensor HAL determines whether the mobile phone supports the second configuration parameter group.
[0104] If the target APP is not the system camera APP (for example, the target APP may be a third-party APP), or the startup operation starts the code scanning function of the system camera APP, the camera sensor HAL may continue to determine whether the mobile phone supports the second configuration parameter group. If the mobile phone supports the second configuration parameter group, it means that the second configuration parameter group can be used, and the camera sensor HAL may execute S208. If the mobile phone does not support the second configuration parameter group, it means that the second configuration parameter group cannot be used, and the camera sensor HAL may execute S206.
[0105] In some embodiments, the camera sensor HAL can determine whether the mobile phone supports the second configuration parameter group according to whether the mobile phone has saved the second configuration parameter group. If the mobile phone has saved the second configuration parameter group, it means that the mobile phone supports the second configuration parameter group.
[0106] It should be noted that Figure 2 The shown S207 is an optional step, and in actual application, the mobile phone may not execute S207.
[0107] S208: The camera sensor HAL uses the second configuration parameter group to control the camera sensor driver to start the camera sensor.
[0108] After determining that the target APP is not the system camera APP (for example, the target APP may be a third-party APP), or the startup operation starts the code scanning function of the system camera APP, the camera sensor HAL may start the camera sensor using the second configuration parameter group.
[0109] In some embodiments, the camera sensor HAL uses the second configuration parameter group to control the camera sensor driver to start the camera sensor, which may include: the camera sensor HAL may send the second configuration parameter group to the camera sensor driver; the camera sensor driver may write the second configuration parameter group into the camera sensor.
[0110] It is understandable that in the second scenario, such as the startup operation is used to start the camera function of a third-party APP, and the startup operation is used to start the code scanning function of the system camera APP, the mobile phone uses the second configuration parameter group to start the camera sensor. Since the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group, it can be seen that the mobile phone uses the second configuration parameter group to start the camera sensor. The startup time of the camera sensor can be shortened, thereby realizing the rapid opening of the mobile phone camera. Quickly opening the mobile phone camera in the second scenario, such as starting the camera function of a third-party APP, or starting the code scanning function of the system camera APP, can meet the user's demand for a faster camera opening speed in the second scenario.
[0111] S209: The target APP controls the display to display a camera interface, where the camera interface includes an image captured by the camera sensor that has completed startup.
[0112] After the camera sensor HAL starts the camera sensor, it can use the started camera sensor to collect images. Then, the mobile phone can generate and display the camera interface in the target APP based on the images collected by the started camera sensor.
[0113] It should be noted that the camera interface may be the first camera interface or the second camera interface. When the startup operation is the first operation, the camera interface may be the first camera interface. When the startup operation is the second operation, the camera interface may be the second camera interface.
[0114] For example, Figure 3 As shown in (a) in FIG. 1 , the start operation may be a user clicking on the icon 311 of the system camera APP, and the camera interface displayed by the mobile phone during the start operation may be the shooting interface 320 in the system camera APP, such as Figure 3 As shown in (b) in .
[0115] For example, Figure 3 As shown in (b) of FIG. 1 , the start operation may be a user clicking an icon 321 corresponding to the code scanning function of the system camera APP. Then, the camera interface displayed by the mobile phone in response to the start operation may be a code scanning interface 330 in the system camera APP, such as Figure 3 As shown in (c) in .
[0116] For example, Figure 4 As shown in (a) in FIG. 1 , the start operation may be a user clicking an icon 411 corresponding to a shooting function of a third-party APP, and the camera interface displayed by the mobile phone in response to the start operation may be a shooting interface 420 in the third-party APP, such as Figure 4 As shown in (b) in .
[0117] For example, Figure 5 As shown in (a) of FIG. 1 , the start operation may be a user clicking an icon 511 corresponding to the code scanning function of the third-party APP, and the camera interface displayed by the mobile phone in response to the start operation may be a code scanning interface 520 in the third-party APP, such as Figure 5 As shown in (b) in .
[0118] In some embodiments, the mobile phone can generate a camera interface based on the image captured by the camera sensor that has been started and the register configuration parameters (or target configuration parameter group) used to configure the camera sensor. The target configuration parameter group can refer to the first configuration parameter group or the second configuration parameter group.
[0119] It is understandable that, since the first configuration parameter group includes registers related to the first camera function (e.g., face shooting function, digital zoom function, and code scanning function), the camera interface generated according to the first configuration parameter group (e.g., the first camera interface described above) may include at least one target function control (e.g., a function control for triggering the face shooting function, a function control for triggering the digital zoom function, and a function control for triggering the code scanning function), each target function control is used to start a camera function corresponding to the target function control in the first camera function. The camera interface generated according to the second configuration parameter group (e.g., the second camera interface described above) may not include the at least one target function control.
[0120] For example, the first configuration parameter group may include register configuration parameters related to the portrait shooting function and register configuration parameters related to the digital zoom function, and the second configuration parameter group does not include register configuration parameters related to the portrait shooting function and register configuration parameters related to the digital zoom function. The camera interface generated by the mobile phone according to the first configuration parameter group may be the shooting interface 320 in the system camera APP, such as Figure 3 The camera interface generated by the mobile phone according to the second configuration parameter group may be a shooting interface 420 in a third-party APP, such as Figure 4 As shown in (b) of FIG. 4 , it can be seen that the shooting interface 320 includes a portrait control 322 related to the portrait shooting function and a zoom control 323 associated with the digital zoom function, while the shooting interface 420 does not include the portrait control 322 and the zoom control 323 .
[0121] It can be understood that this solution optimizes the software process of starting the camera sensor, thereby realizing the rapid opening of the mobile phone camera in the second scenario without replacing or modifying the hardware. This solution can be widely used in a variety of electronic devices.
[0122] In the embodiment of the present application, in response to the start-up operation for starting the camera function of the target APP, the mobile phone first updates the value of the preset identifier, and then determines the register configuration parameters for configuring the camera sensor based on the data of the preset identifier (which may include the above steps S204, S205 and S207). In order to make the updated value of the preset identifier only serve as the basis for determining the target configuration parameter group this time, the mobile phone can continue to update the value of the preset identifier when turning off the camera function of the target APP, so that the value of the preset identifier is restored to the initial value.
[0123] For example, in combination Figure 2 ,like Figure 7 As shown, a camera control method provided in an embodiment of the present application may further include S210-S213 after S209.
[0124] S210: The mobile phone receives a closing operation input by the user for closing the camera function of the target APP.
[0125] After the mobile phone displays the camera interface in response to the start operation, it can receive the closing operation input by the user on the camera interface. For example, the closing operation can be a sliding operation, or a click operation on a designated control on the camera interface. The designated control is used to trigger the closing of the camera function of the target APP.
[0126] It should be noted that the closing operation may be the third operation for closing the camera function of the first APP, or may be an operation for closing the camera function of the second APP.
[0127] For example, taking the camera interface as Figure 4 Taking the shooting interface 420 shown in (b) as an example, the closing operation may be a user clicking operation on the icon 421 in the shooting interface 420 .
[0128] In some embodiments, the shutdown operation can be used not only to shut down the camera function of the target APP, but also to start another new camera function. For example, the shutdown operation is used to shut down the shooting function of the target APP and to start the code scanning function of the target APP. At this time, in response to the shutdown operation, the mobile phone not only executes S211-S213, but also takes the shutdown operation as a new startup operation, and executes S201-S209 in response to the new startup operation.
[0129] For example, Figure 3As shown in (b) in FIG. 1 , the closing operation may be a user clicking an icon 321 corresponding to the code scanning function in the shooting interface 320 of the system camera APP. In response to the user clicking the icon 321 corresponding to the code scanning function, the mobile phone may first execute S211-S213 to close the shooting function of the system camera APP; and then execute S201-S209 to open the code scanning function of the system camera APP.
[0130] S211. The target APP generates a second instruction in response to the closing operation, and sends the second instruction to the camera sensor HAL; the values of the multiple parameters in the second instruction are different from the values of the multiple parameters in the first instruction.
[0131] Exemplarily, taking the case where the values of multiple parameters in the first instruction may include: parameter cmd=0x21, parameter param1=2, parameter param2=0, the values of multiple parameters in the second instruction may include: parameter cmd=0x21, parameter param1=1, parameter param2=-1.
[0132] It should be noted that, except that the values of multiple parameters in the second instruction are different from the values of multiple parameters in the first instruction, the details of S211 can refer to the description of S202 above, and the embodiments of the present application will not be repeated here.
[0133] S212: The camera sensor HAL updates and saves the value of the preset identifier based on the values of the multiple parameters in the second instruction.
[0134] The mobile phone can update the value of the preset identifier based on the values of the multiple parameters in the second instruction, so that the updated value of the preset identifier is equal to the initial value of the preset identifier. For example, the value of the first identifier in the updated preset identifier is equal to the initial value of the first identifier, and the value of the second identifier in the updated preset identifier is equal to the initial value of the second identifier.
[0135] It should be noted that the details of S212 can refer to the description of S203 above, and will not be repeated here in the embodiment of the present application.
[0136] It is understandable that the mobile phone not only updates the value of the preset identifier before starting the camera function of the target APP, but also continues to update the value of the preset identifier when closing the camera function of the target APP, so that the value of the preset identifier is restored to the initial value. In this way, it is possible to avoid the influence of the value of the preset identifier updated this time on the next determination of the target configuration parameter group based on the data of the preset identifier.
[0137] S213, the target APP controls the display to display a camera closing interface.
[0138] The mobile phone can exit the camera interface and display the camera closing interface. The camera closing interface can be the interface displayed before the mobile phone jumps to the camera interface, or it can be the main interface of the mobile phone.
[0139] For example, if the closing operation is a user clicking the icon 421 in the shooting interface 420, the camera closing interface may be the first interface 410 before the mobile phone jumps to the shooting interface 420 of the third-party APP, such as Figure 4 As shown in (a) in .
[0140] In the embodiment of the present application, in response to the start-up operation for starting the camera service of the target APP, the mobile phone can first generate a first instruction, and update the value of the preset identifier based on the values of multiple parameters in the first instruction; and then start the camera sensor by executing the camera start-up task. In the process of executing the camera start-up task, the mobile phone can determine the target configuration parameter group based on the data of the preset identifier.
[0141] In some embodiments, the camera startup task may include a camera initialization task (or open camera task) and a camera configuration task (or config task). The camera initialization task is used to perform some initialization actions on the camera sensor, for example, reading the configuration data of the camera sensor. The camera configuration task is used to configure the data of the initialized camera sensor.
[0142] Optionally, the mobile phone may determine the target configuration parameter group based on preset identified data during the process of executing the camera initialization task; or, determine the target configuration parameter group based on preset identified data during the process of executing the camera configuration task.
[0143] For example, in combination Figure 7 ,like Figure 8 As shown, S204-S208 in a camera control method provided in an embodiment of the present application may include S301-S306.
[0144] S301. The target APP sends a start request to the camera sensor HAL, where the start request is used to trigger the start of the camera sensor.
[0145] In response to the start-up operation for starting the camera function, after sending the first instruction, the target APP can send a start-up request to the camera sensor HAL through the camera service to trigger the camera sensor HAL to start the camera sensor.
[0146] S302: The camera sensor HAL obtains configuration data of the camera sensor in response to the start request; the configuration data of the camera sensor includes a first field.
[0147] In response to the start-up request, the camera sensor HAL may perform a camera start-up task on the camera sensor. The camera initialization task may include: obtaining configuration data of the camera sensor. After the camera initialization task is completed, the camera sensor HAL performs a camera configuration task on the camera sensor to complete the start-up of the camera sensor.
[0148] Exemplarily, the camera sensor HAL obtaining the configuration data of the camera sensor may include: the camera sensor HAL reading the camera identifier (or logicCameraId); reading the pointer related to the camera sensor to obtain the configuration data of the camera sensor. The camera identifier may be used to represent the front camera or the rear camera. The pointer related to the camera sensor may include the HwSensorInfo pointer.
[0149] S303: The camera sensor HAL determines whether the camera sensor supports advance data writing according to the first field.
[0150] Among them, writing data in advance (or powering on in advance) may refer to moving the process of "writing initialization data for the camera sensor" in the camera configuration task into the camera initialization task. In this way, "writing initialization data for the camera sensor" is performed before the camera configuration task.
[0151] If the camera sensor supports writing data in advance, the camera sensor HAL may execute S304 to determine the target configuration parameter group based on the preset identified data during the process of executing the camera initialization task. If the camera sensor does not support writing data in advance, the camera sensor may execute S306 to determine the target configuration parameter group based on the preset identified data during the process of executing the camera configuration task.
[0152] S304: The camera sensor HAL creates and executes a first asynchronous thread to write data to the camera sensor; the first asynchronous thread includes determining register configuration parameters for configuring the camera sensor based on data of a preset identifier.
[0153] If the camera sensor supports writing data in advance, the camera sensor HAL creates and executes a first asynchronous thread for writing initialization data for the camera sensor during the process of executing the camera initialization task. If the first asynchronous thread is created successfully, the camera sensor HAL can continue to execute the camera initialization task and execute the first asynchronous thread.
[0154] It should be noted that the camera initialization task may include the above-mentioned S302-S304.
[0155] In some embodiments, if the first asynchronous thread is created successfully, the camera sensor HAL may set a state value corresponding to the first asynchronous thread to true.
[0156] In some embodiments, if the first asynchronous thread creation fails, the camera sensor HAL may execute S306 after completing the camera initialization task.
[0157] In some embodiments, the first asynchronous thread may include determining a target configuration parameter group based on data of a preset identifier, and may also include steps such as writing register configuration parameters to the camera sensor, writing calibration parameters to the camera sensor, and controlling the camera sensor to power on.
[0158] For example, Fig. 9 As shown, the first asynchronous thread may include S401-S409, the above S204, the above S205 and the above S207.
[0159] S401, the camera sensor HAL initializes the core system software layer CSL service and obtains the hardware node handle of the CSL.
[0160] The camera sensor HAL can obtain the hardware node handle handle that initializes the core system software layer (CSL). Among them, the hardware node handle handle is used to access and operate the camera sensor driver. The CSL service can provide a set of functions or methods that allow operations related to the camera sensor to be performed by using the hardware node handle handle of the CSL.
[0161] In some embodiments, the camera sensor HAL may send a third instruction to the camera sensor driver. In response to the third instruction, the camera sensor driver creates a hardware node handle handle and controls the camera sensor to power on; the camera sensor driver also returns the hardware node handle handle to the camera sensor HAL.
[0162] Exemplarily, the third instruction may be an input / output (I / O) control command. The third instruction may include a code segment for controlling the camera sensor to power on as follows: Cam_sensor_power_up.
[0163] Exemplarily, the camera sensor driver may communicate with the camera sensor via an I2C bus.
[0164] S402: The camera sensor HAL starts a power lock on the camera sensor through the camera sensor driver.
[0165] The camera sensor HAL can control the camera sensor driver to start the power lock on the camera sensor through the hardware node handle handle to prohibit the operation of the camera sensor power. Then, the camera sensor HAL can determine whether the target configuration parameter group is the first configuration parameter group or the second configuration parameter group by executing the above S204, S205 and S207. If the target configuration parameter group is determined to be the first configuration parameter group, the camera sensor HAL executes S403-S404; if the target configuration parameter group is determined to be the second configuration parameter group, the camera sensor HAL executes S405-S406.
[0166] Exemplarily, the camera sensor HAL can send a power lock setting instruction to the camera sensor driver through the hardware node handle handle; the setting instruction can include a power identifier. The camera sensor driver parses the I2CHeader parameter in the setting instruction to obtain the power identifier, and starts the power lock for the camera sensor based on the power identifier. For example, when the power identifier = 0xFFFF, the camera sensor driver starts the power lock for the camera sensor.
[0167] S403: The camera sensor HAL sends a first configuration parameter group to the camera sensor driver.
[0168] If the camera sensor HAL determines that the target configuration parameter group is the first configuration parameter group, it may send a first initialization instruction including the first configuration parameter group to the camera sensor driver through the hardware node handle handle.
[0169] S404: The camera sensor driver writes a first configuration parameter group into the camera sensor.
[0170] After receiving the first initialization instruction, the camera sensor driver may parse the first initialization instruction to obtain a first configuration parameter group, and write the first configuration parameter group to the camera sensor.
[0171] S405: The camera sensor HAL sends a second configuration parameter group to the camera sensor driver.
[0172] If the camera sensor HAL determines that the target configuration parameter group is the second configuration parameter group, it may send a second initialization instruction including the second configuration parameter group to the camera sensor driver through the hardware node handle handle.
[0173] S406: The camera sensor driver writes a second configuration parameter group into the camera sensor.
[0174] After receiving the second initialization instruction, the camera sensor driver may parse the second initialization instruction to obtain the first configuration parameter group, and write the second configuration parameter group to the camera sensor.
[0175] S407: The camera sensor HAL obtains calibration parameters of the camera sensor and sends the calibration parameters to the camera sensor driver.
[0176] The camera sensor HAL can obtain the calibration parameters of the camera sensor from the preset storage address. Then, the camera sensor HAL can send a calibration instruction including the calibration parameters to the camera sensor driver through the hardware node handle handle. The calibration parameters of the camera sensor can be used to calibrate the differences in shooting effects caused by the device manufacturing process of the camera sensor.
[0177] S408: The camera sensor driver writes calibration parameters to the camera sensor.
[0178] After receiving the calibration instruction, the camera sensor driver may parse the calibration instruction to obtain calibration parameters, and write the calibration parameters to the camera sensor.
[0179] In some embodiments, the camera sensor HAL may utilize the calibration parameters to calibrate some register configuration parameters of the camera sensor configuration.
[0180] S409: The camera sensor HAL releases the hardware node handle of the CSL.
[0181] The camera sensor HAL can control the camera sensor driver to release the hardware node handle of the CSL, and can also control the camera sensor driver not to perform the camera sensor power-off operation, so that the camera sensor remains powered on.
[0182] It is understandable that if the camera sensor HAL creates and executes the first asynchronous thread for writing initialization data for the camera sensor during the execution of the camera initialization task, it can be achieved that the initialization data (including the target configuration parameter group and the verification parameters) starts to be written to the camera sensor during the execution of the camera initialization task. Since there may be a blank period between the camera initialization task and the camera configuration task, the mobile phone starts to write initialization data to the camera sensor during the execution of the camera initialization task, which can effectively utilize the blank period. Compared with starting to write initialization data to the camera sensor during the execution of the camera configuration task, the mobile phone writes initialization data to the camera sensor before the camera configuration task, which can shorten the startup time of the camera sensor, thereby realizing quick opening of the camera.
[0183] S305: The camera sensor HAL configures the camera sensor to complete the startup of the camera sensor.
[0184] After the camera sensor HAL completes the camera initialization task, it executes the camera configuration task to complete the startup of the camera sensor. The camera configuration task may include S305.
[0185] In some embodiments, the camera sensor HAL configuring the camera sensor may include: the camera sensor HAL writing other configuration parameters to the camera sensor through the camera sensor driver. The other configuration parameters may refer to configuration parameters different from both the register configuration parameters and the calibration parameters.
[0186] S306: The camera sensor HAL configures the camera sensor, and creates and executes a second asynchronous thread to complete the startup of the camera sensor; the second asynchronous thread includes determining register configuration parameters for configuring the camera sensor based on data of a preset identifier.
[0187] If the camera sensor does not support writing data in advance, it means that the camera sensor does not write initialization data to the camera sensor in the camera initialization task. Then, the camera sensor HAL creates and executes a second asynchronous thread for writing initialization data to the camera sensor during the process of executing the camera configuration task (including configuring the camera sensor). If the second asynchronous thread is successfully created, the camera sensor HAL can continue to execute the camera configuration task and execute the second asynchronous thread. The second asynchronous thread and the first asynchronous thread can be the same.
[0188] It should be noted that the details of the second asynchronous thread can refer to the above description of the first asynchronous thread, and will not be repeated here in the embodiment of the present application.
[0189] In an embodiment of the present application, the mobile phone can generate a second instruction in response to a close operation for shutting down the camera function of the target APP, and update the value of a preset identifier based on the values of multiple parameters in the second instruction; and then execute a camera close task (or called a close camera task) to turn off the camera sensor.
[0190] For example, in combination Figure 8 ,like Fig.10 As shown, a camera control method provided in an embodiment of the present application may further include S307 after S212 and before S213.
[0191] S307: The camera sensor HAL releases the resources occupied by the asynchronous thread, and controls the camera sensor to power off through the camera sensor driver.
[0192] The resources occupied by the asynchronous thread may include: resources occupied by a first asynchronous thread created by the camera sensor HAL, or resources occupied by a second asynchronous thread created by the camera sensor HAL.
[0193] For example, the camera sensor HAL may control the power-off of the camera sensor by removing the advance power-on function in the asynchronous thread pool.
[0194] In some embodiments, the camera closing task may include obtaining configuration data of the camera sensor, and S307 .
[0195] A camera control method provided by an embodiment of the present application may include the following steps A1-A6. Step A1: receiving a first operation input by a user for starting the camera function of the first application; Step A2: determining a first configuration parameter group from multiple configuration parameter groups in response to the first operation; Step A3: starting the camera sensor according to the first configuration parameter group, and displaying a first camera interface; Step A4: receiving a second operation input by a user for starting the camera function of the second application; Step A5: determining a second configuration parameter group from the multiple configuration parameter groups in response to the second operation; Step A6: starting the camera sensor using the second configuration parameter group, and displaying a second camera interface.
[0196] Among them, steps A1 to A3 may include the above-mentioned S201 to S205, S206 and S209. Steps A4 to A6 may include the above-mentioned S201 to S205 and S207 to S209.
[0197] It should be noted that the embodiment of the present application does not limit the order of step A1-step A3 and step A4-step A6. For example, step A1-step A3 may be performed first and then step A4-step A6, or step A4-step A6 may be performed first and then step A1-step A3.
[0198] In an embodiment of the present application, the mobile phone determines that the target configuration parameter group is the first configuration parameter group among multiple configuration parameter groups in a first scenario, and determines that the target configuration parameter group is the second configuration parameter group among multiple configuration parameter groups in a second scenario.
[0199] It should be noted that the first scenario described in the above embodiment includes the shooting function of the system camera APP in the mobile phone, and the second scenario includes the scanning function of the system camera APP in the mobile phone, and the camera function (including the shooting function and the scanning function) of any third-party APP in the mobile phone, which is only an optional example. The mobile phone can also redefine the first scenario and the second scenario. For example, the mobile phone can distinguish the first scenario and the second scenario according to the shooting function and the camera function. At this time, the first scenario may include the shooting function of any APP in the mobile phone, and the second scenario may include the scanning function of any APP in the mobile phone. For another example, the mobile phone can distinguish the first scenario and the second scenario according to the system APP and the third-party APP. At this time, the first scenario may include the camera function of any system APP (including the system camera APP) in the mobile phone, and the second scenario may include the camera function of any third-party APP in the mobile phone.
[0200] It should also be noted that the multiple configuration parameter groups described in the above embodiment include the first configuration parameter group and the second configuration parameter group, which is also an optional example. The mobile phone can also divide other configuration parameter groups that are different from the first configuration parameter group and the second configuration parameter group, and the mobile phone can also be set to use the other configuration parameter group in a third scenario. The third scenario is different from the first scenario and the second scenario. The other configuration parameter group may include at least one register configuration parameter.
[0201] To sum up, in the embodiments of the present application, there is no restriction on the specific number of multiple configuration parameter groups, the number of multiple scenes and the form of scene division, and the correspondence between multiple configuration parameter groups and multiple scenes.
[0202] It is understandable that the above-mentioned electronic device (such as mobile phone) includes hardware structures and / or software modules corresponding to the execution of each function in order to realize the above-mentioned functions. Those skilled in the art should be easily aware that, in conjunction with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but this implementation should not be considered to exceed the scope of the embodiments of the present application.
[0203] The embodiment of the present application can divide the functional modules of the above-mentioned electronic device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0204] In the case of dividing each functional module into corresponding functional modules, refer to Fig.11 As shown, the embodiment of the present application provides a camera control device applied to an electronic device, and the camera control device can implement the camera control method provided in the above embodiment. In practice, the camera control device can be a processor in the electronic device. The camera control device can include: a receiving module 701, a configuration determination module 702 and a control module 703.
[0205] The receiving module 701 is used to receive a first operation input by a user for starting a camera function of a first application. The configuration determination module 702 is used to determine a first configuration parameter group from a plurality of configuration parameter groups in response to the first operation; the first configuration parameter group includes a plurality of register configuration parameters, and the register configuration parameters are used to configure a camera sensor. The control model is used to start the camera sensor according to the first configuration parameter group and display a first camera interface.
[0206] The receiving module 701 is further used to receive a second operation input by a user for starting a camera function of a second application. The configuration determination module 702 is further used to determine a second configuration parameter group from a plurality of configuration parameter groups in response to the second operation; wherein the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group. The control model is further used to start the camera sensor using the second configuration parameter group and display a second camera interface.
[0207] Optionally, the first application and the second application are the same, the camera function of the first application is a shooting function, and the camera function of the second application is a code scanning function. The first configuration parameter group includes: register configuration parameters associated with the shooting function; the second configuration parameter group includes register configuration parameters associated with the code scanning function.
[0208] Optionally, the first application and the second application are system camera applications or third-party applications.
[0209] Optionally, the camera function of the first application is a shooting function of a system camera application, and the camera function of the second application is a code scanning function of a third-party application.
[0210] Optionally, the camera function of the first application is a shooting function of a system camera application, and the camera function of the second application is a shooting function of a third-party application.
[0211] Optionally, the first camera interface includes at least one target function control, and the second camera interface does not include at least one target function control; wherein the at least one target function control includes: a function control for triggering a face shooting function, and a function control for triggering a digital zoom function.
[0212] Optionally, the configuration determination module 702 is further used to update the value of the preset identifier based on the camera function of the first application in response to the first operation before determining the first configuration parameter group from the multiple configuration parameter groups. The preset identifier includes at least one of the following: a first identifier corresponding to each application category in at least one application category, and a second identifier corresponding to each camera function category in at least one camera function category. At least one application category includes a system camera application and a third-party application. At least one camera function category includes a shooting function and a code scanning function.
[0213] The configuration determination module 702 is specifically configured to determine a first configuration parameter group from multiple configuration parameter groups based on a value of a preset identifier.
[0214] Optionally, the preset identifier includes a first identifier corresponding to the system camera application and a second identifier corresponding to the code scanning function.
[0215] The configuration determination module 702 is specifically used to determine the first configuration parameter group from multiple configuration parameter groups if the numerical value of the first identifier corresponding to the system camera application indicates that the first application is the system camera application, and the numerical value of the second identifier corresponding to the code scanning function indicates that the camera function of the first application is not the code scanning function.
[0216] Optionally, the receiving module 701 is used to receive a third operation input by a user for closing a camera function of the first application.
[0217] The configuration determination module 702 is further configured to update the value of the preset identifier in response to the third operation, so that the updated value of the preset identifier is equal to the initial value of the preset identifier. The control module 703 is further configured to display a camera closing interface.
[0218] Regarding the camera control device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the camera control in the above embodiment, and will not be elaborated here. The relevant beneficial effects can also refer to the relevant beneficial effects of the above camera control, and will not be repeated here.
[0219] An embodiment of the present application also provides an electronic device, which includes: a memory and one or more processors; the memory is coupled to the processor; wherein computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the camera control method provided in the aforementioned embodiment.
[0220] For example, the specific structure of the electronic device is described by taking a mobile phone as an example. Fig.12As shown, the mobile phone may include a processor 810, an external memory interface 820, an internal memory 821, a sensor module 830, a display screen 840, etc. Among them, the sensor module 830 may include a touch sensor 830A, etc.
[0221] The processor 810 may be configured to execute various functions or steps performed by the mobile phone in the above method embodiment.
[0222] The processor 810 may also be provided with a memory for storing instructions and data, for example, storing text style 1 corresponding to the first operation. In some embodiments, the memory in the processor 810 is a cache memory. The memory may store instructions or data that the processor 810 has just used or cyclically used. If the processor 810 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 810 is reduced, and the efficiency of the system is improved.
[0223] The external memory interface 820 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone. The external memory card communicates with the processor 820 through the external memory interface 820 to realize the data storage function. The internal memory 820 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 820 executes the various functions or steps performed by the mobile phone in the above method embodiment by running the instructions stored in the internal memory 820. The internal memory 821 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, at least one APP required for a function (such as a font adjustment function), etc. The data storage area may store data created during the use of the mobile phone (such as a default text style, the first text style, the preset matching relationship, etc.), etc. In addition, the internal memory 821 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.
[0224] The display screen 840 is used to display an interface, etc. The display screen 840 includes a display panel. The display panel can be a liquid crystal display (LCD), a light-emitting diode (LED), an organic light-emitting diode (OLED), etc.
[0225] Among them, if the display screen 840 in the embodiment of the present application is integrated with a touch sensor 830A, the display screen 840 can be called a touch screen. The touch sensor 830A can also be called a "touch panel". That is, the display screen 840 may include a display panel and a touch panel. The touch sensor 830A is used to detect a touch operation acting on or near it. After the touch sensor 830B detects a touch operation (such as the first operation mentioned above, the second operation mentioned above), it can trigger the driver of the kernel layer of the mobile phone to periodically scan the touch parameters generated by the touch operation. Then, the driver of the kernel layer passes the touch parameters to the relevant modules of the upper layer, so that the relevant modules can determine the touch events corresponding to the touch parameters. In the embodiment of the present application, the specific process of the above-mentioned interface adjustment method is described by taking the display screen 840 as a display screen (i.e., a touch screen) integrated with a touch sensor as an example.
[0226] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone. In other embodiments, the mobile phone may include more or fewer components than shown in the figure, or combine some components, or split 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] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the camera control method provided in the above embodiment.
[0228] An embodiment of the present application also provides a computer program product, which includes executable instructions. When the computer program product is run on an electronic device, the electronic device executes the camera control method provided in the aforementioned embodiment.
[0229] The present application also provides a chip system, such as Fig.13 As shown, the chip system 900 includes at least one processor 901 and at least one interface circuit 902. The processor 901 and the interface circuit 902 can be interconnected through a line. For example, the interface circuit 902 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 902 can be used to send signals to other devices (such as the processor 901).
[0230] Exemplarily, the interface circuit 902 can read the instruction stored in the memory and send the instruction to the processor 901. When the instruction is executed by the processor 901, the electronic device can execute each step in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.
[0231] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0232] In the several embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0233] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0234] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0235] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0236] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A camera control method, characterized in that: Applied to an electronic device including a camera sensor, the electronic device including a first application and a second application, the method comprising: receiving a first operation input by a user for starting a camera function of the first application; In response to the first operation, determining a first configuration parameter group from a plurality of configuration parameter groups; the first configuration parameter group includes a plurality of register configuration parameters, the register configuration parameters being used to configure the camera sensor; Starting the camera sensor according to the first configuration parameter group and displaying a first camera interface; receiving a second operation input by a user for starting a camera function of the second application; In response to the second operation, determining a second configuration parameter group from the plurality of configuration parameter groups; wherein the number of register configuration parameters included in the second configuration parameter group is less than the number of register configuration parameters included in the first configuration parameter group; The camera sensor is started using the second configuration parameter group, and a second camera interface is displayed.
2. The method according to claim 1, characterized in that The first application is the same as the second application, the camera function of the first application is a shooting function, and the camera function of the second application is a code scanning function; The first configuration parameter group includes: register configuration parameters associated with the shooting function; the second configuration parameter group includes register configuration parameters associated with the code scanning function.
3. The method according to claim 2, characterized in that The first application and the second application are system camera applications or third-party applications.
4. The method according to claim 1, characterized in that: The camera function of the first application is a shooting function of a system camera application, and the camera function of the second application is a code scanning function of a third-party application.
5. The method according to claim 1, characterized in that The camera function of the first application is a shooting function of a system camera application, and the camera function of the second application is a shooting function of a third-party application.
6. The method according to claim 5, characterized in that The first camera interface includes at least one target function control, and the second camera interface does not include the at least one target function control; wherein the at least one target function control includes: a function control for triggering a face shooting function, and a function control for triggering a digital zoom function.
7. The method according to any one of claims 1 to 6, characterized in that Before determining the first configuration parameter group from the plurality of configuration parameter groups, the method further includes: In response to the first operation, updating a value of a preset identifier based on the camera function of the first application; wherein the preset identifier includes at least one of the following: a first identifier corresponding to each application category in at least one application category, and a second identifier corresponding to each camera function category in at least one camera function category; the at least one application category includes a system camera application and a third-party application; the at least one camera function category includes a shooting function and a code scanning function; The step of determining the first configuration parameter group from the plurality of configuration parameter groups includes: Based on the value of the preset identifier, the first configuration parameter group is determined from the multiple configuration parameter groups.
8. The method according to claim 7, characterized in that The preset identifier includes a first identifier corresponding to the system camera application and a second identifier corresponding to the code scanning function; The determining the first configuration parameter group from the multiple configuration parameter groups based on the value of the preset identifier includes: If the numerical value of the first identifier corresponding to the system camera application indicates that the first application is the system camera application, and the numerical value of the second identifier corresponding to the code scanning function indicates that the camera function of the first application is not the code scanning function, then the first configuration parameter group is determined from the multiple configuration parameter groups.
9. The method according to claim 7 or 8, characterized in that: The method further comprises: receiving a third operation input by a user for closing a camera function of the first application; In response to the third operation, updating the value of the preset identifier so that the updated value of the preset identifier is equal to the initial value of the preset identifier; The camera close interface is displayed.
10. An electronic device, characterized in that: The electronic device comprises: a processor, a memory and a communication interface; the memory and the communication interface are coupled to the processor, the memory is used to store computer program code, and the computer program code comprises computer instructions; wherein, when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1-9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 9.
Citation Information
Patent Citations
Processing method and electronic equipment
CN115514894A
Camera parameter configuration method and electronic equipment
CN115550541A
