A video encoding and decoding method using IMU data, XR device and computer storage medium
By using IMU data for motion estimation and inter-frame prediction on XR devices, the problem of failing to fully utilize sensor data in the existing technology is solved, and the efficiency and quality of video encoding and decoding are improved, especially in poor network environments. , improving the quality of video communication.
Patent Information
- Application Number
- CN202110303344.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-22
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-03-22
AI Technical Summary
Existing video encoding and decoding solutions fail to make full use of sensor data on XR devices, resulting in reduced video transmission quality in poor network environments. Especially when inter-frame prediction information is lost, encoding and decoding efficiency and quality are difficult to improve.
Motion estimation is performed by obtaining IMU data, and inter-frame prediction and compression are performed based on the motion estimation results. IMU data is used to reduce the direction search and traversal of inter-frame prediction, improve video encoding and decoding efficiency, and use IMU data for motion estimation during the video decoding process. to compensate for the loss of inter-frame prediction information.
It improves the efficiency and quality of video encoding and decoding, especially when the network is poor, improves the quality of video communication, and achieves more robust decoding and more efficient encoding.
Smart Images

Figure CN112911294B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video encoding and decoding, and in particular to a video encoding and decoding method using IMU data, an XR device and a computer storage medium. Background Art
[0002] In most shot video sequences, the contents of adjacent images are very similar and the background images change very little. Therefore, there is no need to encode all the information of each image. Instead, only the motion information of the moving objects in the current image needs to be transmitted to the decoder. The current image can be restored using the content of the previous image and the motion information of the current image. This can effectively save bit rate.
[0003] At present, remote collaboration, real-time video calls, real-time video cloud storage backup, local video compression, etc. on XR devices (AR, MR, VR, etc.) are all using mature H.264 / HEVC solutions. In the existing technical solutions, the mainstream real-time remote collaboration is still H.264, and the encoding complexity is lower than HEVC; the non-real-time encoders in the mainstream storage solutions are mostly HEVC with higher complexity and higher compression efficiency; in the encoding process of H.264 / HEVC, encoding is performed through intra-frame and inter-frame prediction, and the consideration is to remove the contextual redundant information (space and time) of the video frame itself; the spatial redundancy of the video frame is encoded through intra-frame prediction: H.264 will completely traverse 9 intra-frame prediction modes, and each direction will perform a complete prediction, transformation, quantization, inverse quantization, inverse transformation, and then compare the bit rate to obtain the best choice; similarly, H.265 needs to traverse 35 modes, which is more complex; the temporal redundancy of the video frame is encoded through inter-frame prediction: find the frame that best matches the current frame within a certain range to perform motion estimation and obtain the motion vector.
[0004] In some video shooting scenarios using XR devices (such as AR headsets and MR headsets), such as remote collaboration, users wearing XR devices will communicate with remote experts via video. The XR device will capture the video images in the user's field of view and transmit them to the expert. At this time, the scenes captured by the XR device are mainly fixed scenes, and factories are generally located in remote areas with poor network environments. Traditional video encoding and decoding solutions only consider software solutions and do not maximize the value of various sensors on XR devices. Summary of the invention
[0005] The object of the present invention is to provide a video encoding and decoding method using IMU data, which can improve the efficiency of video encoding and decoding and improve the quality of video transmission in the case of poor network transmission environment and frame loss.
[0006] According to the first aspect of the present invention, one or more embodiments of the present invention provide a video encoding method using IMU data, comprising: obtaining IMU data when the original video data stream is shot, performing motion estimation on the original video data stream based on the IMU data, performing inter-frame prediction on the original video data stream based on the result of the motion estimation, and compressing the original video data stream based on the result of the inter-frame prediction to obtain a compressed video data stream, and encapsulating the IMU data and the compressed video data stream.
[0007] According to the second aspect of the present invention, one or more embodiments of the present invention provide an XR device, characterized in that it includes a camera, an IMU sensor, a processor and a memory, the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above-mentioned first aspect are performed.
[0008] According to the third aspect of the present invention, one or more embodiments of the present invention provide a video decoding method using IMU data, including obtaining a compressed video data stream containing IMU data, if inter-frame prediction information is lost during the video decoding process, using the IMU data to perform motion estimation on the video data stream, based on the result of the motion estimation, performing inter-frame prediction on the original video data stream, and decoding the video data stream based on the result of the inter-frame prediction.
[0009] According to a fourth aspect of the present invention, one or more embodiments of the present invention provide a computer storage medium, characterized in that it includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the steps described in the third aspect of the present invention.
[0010] By using IMU information to perform inter-frame prediction for video encoding, the 360° direction search during inter-frame prediction and the traversal execution of video encoding and decoding are saved. The rotation information and acceleration information corresponding to each frame can also be used to achieve more robust decoding, which can improve the efficiency of video encoding and decoding, especially improve the quality of video communication under poor network conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a flowchart of a method for video encoding using IMU data according to one or more embodiments of the present invention;
[0012] Figure 2 is a schematic diagram of spatial three-dimensional coordinates of an XR device according to one or more embodiments of the present invention;
[0013] Figure 3 is a schematic diagram of motion estimation of an XR device according to one or more embodiments of the present invention;
[0014] Figure 4 is a schematic diagram of performing inter-frame prediction on an original video data stream according to one or more embodiments of the present invention;
[0015] Figure 5 is a flow chart of a method for performing video decoding using IMU data according to one or more embodiments of the present invention. DETAILED DESCRIPTION
[0016] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the specific implementation method, structure, characteristics and effects of a video encoding and decoding method using IMU data proposed in the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments.
[0017] According to one aspect of the present invention, Figure 1 As shown, a flowchart of a method for video encoding using IMU data according to one or more embodiments of the present invention is shown, which specifically includes:
[0018] S1, obtain the IMU data when the original video data stream is shot;
[0019] S2. Based on the IMU data, perform motion estimation on the original video data stream;
[0020] S3, based on the result of the motion estimation, performing inter-frame prediction on the original video data stream, and based on the result of the inter-frame prediction, compressing the original video data stream to obtain a compressed video data stream;
[0021] S4. Encapsulate the IMU data and the compressed video data stream.
[0022] In step S1, the IMU data when the original video data stream is shot is obtained. Specifically, the XR device that shoots the video data stream includes an IMU sensor (inertial sensor), and the IMU sensor is configured to record IMU data in real time as the camera shoots the video. The IMU data is used to reflect the movement and rotation of the XR device when shooting the video data stream, and the corresponding movement and rotation amount is estimated. In one or more embodiments, the XR device is a near-eye display device such as AR glasses, MR glasses, and AR headbands. The IMU data obtained by the XR device can be associated with the shooting time, or associated with the video frame, that is, to ensure that the obtained IMU data can correspond to the video data stream shot at the same time. In a preferred embodiment, since the frequency of the IMU sensor acquiring data is usually greater than the frame rate of the video, that is, one video frame will correspond to multiple IMU data, the IMU data within the time corresponding to each frame of the original video data stream can be mean filtered, and the mean filtered IMU data is associated with each frame to reduce the amount of IMU data associated with the video data stream.
[0023] In step S2, based on the IMU data, motion estimation can be performed on the original video data stream. The principle of motion estimation is to divide each frame in the video data stream into many non-overlapping blocks, and assume that the displacement of all pixels in the block is the same. Then, for each block, within a given search range of the reference frame, according to a certain matching criterion, find the block that is most similar to the current block, that is, the matching block. The relative displacement between the matching block and the current block is the motion vector (motion vector, MV). The process of obtaining the motion vector is called motion estimation.
[0024] In one of the embodiments, if there is no fast-moving object in the scene captured by the XR device, the motion vector in the video data stream can be considered to be determined by the movement and rotation of the XR device, so the movement of the XR device and the MV can match. In another embodiment, if there is a fast-moving object in the captured scene, the movement of the XR device calculated by the IMU data and the MV cannot match due to the influence of both the movement of the object and the movement of the XR device. Therefore, it can be determined by judging whether the original video data stream contains a moving object. If so, the IMU data is not used for motion estimation. Specifically, in one of the embodiments, user input or a pre-set method can be used to determine whether to start step S2. In another embodiment, the moving object detection algorithm in the CV algorithm can also be used to determine whether there is a fast-moving object in the captured scene.
[0025] In some implementations of step S2, it may also be determined whether the norms of the acceleration and angular velocity in the IMU data are greater than a certain threshold value. If not, the IMU data is not used for motion estimation. It may be determined whether the XR device has obvious movement by using the first or second norm of the IMU data to determine whether it is greater than a certain threshold value. If it can be determined from the IMU data that the XR device is basically stationary, the IMU data may not be used for motion estimation.
[0026] In some embodiments of step S2, it further includes: using the acceleration in the IMU data to estimate the moving direction of the camera FOV, using the angular velocity in the IMU data to estimate the rotation direction of the camera FOV, calculating the motion vector of the camera FOV that shoots the original video data stream through the moving direction and the rotation direction, and performing motion estimation based on the motion vector.
[0027] The following is an exemplary and detailed description of the motion estimation algorithm of step S2. Figure 2 The schematic diagram of the spatial three-dimensional coordinate distribution based on the XR device is shown, where the Z axis is the direction of the camera FOV of the XR device, that is, facing the front of the XR device, the X axis is the direction from left to right when the bystander faces the XR device and observes the XR device plane, and the Y axis is the upward direction of the XR device perpendicular to the XZ plane, which can be understood as the direction perpendicular to the ground. AccX, AccY, and AccZ are defined as the acceleration of the IMU data in the YZ / XZ / XY plane, which can be directly or indirectly obtained by the IMU sensor; Wx, Wy, and Wz are defined as the angular velocity of the device when it rotates around the X, Y, and Z axes, which can also be directly or indirectly obtained by the IMU sensor. AngleX, AngleY, and AngleZ are defined as the angle change value within Δτ time, where Δτ is the timestamp current_timestamp of the IMU data minus the timestamp prev_timestamp of the previous IMU data. On this basis, α, β, and γ are respectively recorded as abbreviations of AngleX, AngleY, and AngleZ, and their calculation methods are as follows:
[0028] △τ=current_timestamp-prev_timestamp
[0029]
[0030]
[0031]
[0032] Among them, AngleX_prev, AngleY_prev, and AngleZ_prev are the values calculated by the last formula, that is, the angle values at the last moment.
[0033] Specifically, in one or more embodiments, the acceleration data in the IMU sensor can be processed according to the following algorithm. If AccX, AccY, and AccZ are all less than ξ (ξ is a value close to 0, and can be taken as 0.1 without loss of generality), the XR device has no acceleration in each axis and no acceleration-related processing is performed; if two of AccX, AccY, and AccZ are greater than ξ, and only one is greater than ξ, without loss of generality, assuming that there is acceleration in the Z-axis direction, the inter-frame prediction direction of the current macroblock can be set to the same position of the previous frame; if the acceleration on one of AccX, AccY, and AccZ is less than ξ, and the acceleration on two axes is greater than ξ, without loss of generality, assuming that AccX and AccY are greater than ξ, the movement angle θ in the XY plane is arctan (AccY / AccX). Since the movement of the IMU corresponds to and reacts to the movement of the real natural world, when the XR device moves from Frame T-1 to Frame T, the movement direction presented by the device is θ. However, at Frame T, when the macroblock at Frame T-1 is used for prediction, the direction of the motion search is 90-θ=90-arctan(AccY / AccX).
[0034] In other embodiments, if the IMU sensor of the XR device obtains angular velocity data, the steering problem of the XR device is given priority. According to the above formula, it can be known that α, β, and γ are the offset angles of the device when it rotates around the X, Y, and Z axes, respectively. If Wx, Wy, and Wz are all less than ξ (ξ is a value close to 0, and can be taken as 0.1 without loss of generality), the XR device has no angular velocity on each axis, and no angular velocity related processing is performed; if the rotation angle of Wx, Wy, and Wz in any direction exceeds the FOV field of view, it can be considered that the XR device is rotating rapidly, and inter-frame prediction is meaningless at this time, and angular velocity processing is not required; if one of Wx, Wy, and Wz is greater than ξ, and the other two are less than ξ, without loss of generality, assuming rotation around the Z axis, the inter-frame prediction direction of the current macroblock comes from the direct direction of the previous frame (corresponding position direction), which can be estimated as follows. Figure 3 As shown, suppose the XR device rotates at an angle of Wz=θ in the XY plane, that is, at frame t0, the environmental objects in the device are at position D'. At frame t1, the environmental objects displayed in the device are still at position D. However, when inter-frame prediction is performed at t1, it is equivalent to using D' at t0 to perform inter-frame search and predict the macroblock at position D. Therefore, ∠DD'X" needs to be calculated. Finally, the direction of D relative to D' is:
[0035] ∠XOX'=∠DOD'=∠YOY'=θ
[0036] ∠OD'D=∠ODD'=90-θ / 2
[0037] ∠OD'Y=90-θ
[0038] ∠DD'X”=180-∠OD’Y-∠OD’D=3θ / 2
[0039] That is, when determining the inter-frame search, the search may be performed from the coordinate system direction -3θ / 2 from D', thereby improving the efficiency of the inter-frame prediction in step S3.
[0040] When a person wearing an XR device moves in the Z-axis direction, the acceleration of the IMU in the visual direction (Z-axis) of the XR device can be used to calculate the movement trend of the device in various directions and the distance of movement, thereby determining the movement trajectory of the device and the direction of inter-frame prediction, reducing the traversal and search of invalid directions one by one. In the case of no movement in the Z-axis direction, the acceleration of the IMU in the X / Y direction can be used to calculate the movement trend of the XR device in various directions and the distance of movement, thereby determining the horizontal or vertical movement trajectory of the device, directly determining the direction of inter-frame prediction, and reducing the traversal and search of invalid directions. Using the gyroscope information of the IMU, the rotation angle of the XR device can be estimated, and then the search direction of inter-frame prediction can be directly determined, reducing the traversal and search of invalid angles, greatly improving the encoding speed.
[0041] In step S3, inter-frame prediction is performed on the original video data stream based on the result of the motion estimation, and the original video data stream is compressed based on the result of the inter-frame prediction to obtain a compressed video data stream. Specifically, inter-frame prediction refers to the process of predicting a reference block from an adjacent encoded image in a block to be encoded in the current image, with the purpose of removing the temporal redundancy of the video signal. In one embodiment, the starting direction of the motion search can be determined based on the result of the motion estimation obtained in step S2, thereby accelerating the process of inter-frame prediction. In another embodiment, the distance of the motion search can be calculated based on the result of the motion estimation obtained in step S2, thereby accelerating the process of inter-frame prediction. In another embodiment, the direction and distance of the motion search can be determined based on the result of the motion estimation obtained in step S2, thereby accelerating the process of inter-frame prediction. Based on the result of the inter-frame prediction, the original video data stream can be compressed, and the compression method can adopt a compression algorithm defined by video protocols such as H.264 and H.265 to obtain a compressed video data stream.
[0042] like Figure 3As shown, an example of inter-frame prediction of the original video data stream is shown. In order to simplify the description, in this example, only a fixed object 100 is considered, regardless of whether there is other background data in the video frame. In the Nth frame, the object 100 is located at the (2,2) position of the video frame. In the N+1th frame, the object 100 is at the (3,3) position. Therefore, the motion vector MV=(1,1) can be calculated. Since the object 100 is a fixed object, the movement of the object 100 is caused by the movement of the shooting device, so the movement of the shooting device can be used to estimate the motion vector. For example, in this example, the horizontal and vertical accelerations of the IMU of the shooting device can be used to predict the horizontal and vertical movement distances of the device, thereby calculating the movement direction and movement distance of the device.
[0043] In step S4, the IMU data and the compressed video data stream are encapsulated. In standards such as H.264, additional enhancement information can be added to the video data, and the IMU data can be encapsulated as additional enhancement information and the video data stream for use in video data stream decoding. The specific method of use can be seen in the description of steps A1-A3 below.
[0044] According to another aspect of the present invention, an XR device is disclosed, including a camera, an IMU sensor, a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps or methods described in the above steps S1-S4 are executed, and the same or similar technical effects are achieved, which will not be repeated here. XR devices are a general term for three types of devices: AR (augmented reality), MR (mixed reality), and VR (virtual reality). They are usually display devices worn in front of the human eye, which can achieve near-eye display, thereby freeing the user's hands.
[0045] According to another aspect of the present invention, Figure 3 As shown, a flowchart of a method for video decoding using IMU data according to one or more embodiments of the present invention is shown, which specifically includes:
[0046] A1. Obtain the compressed video data stream containing IMU data;
[0047] A2. If inter-frame prediction information is lost during video decoding, use IMU data to perform motion estimation on the video data stream;
[0048] A3. Based on the result of the motion estimation, perform inter-frame prediction on the original video data stream, and based on the result of the inter-frame prediction, decode the video data stream.
[0049] In step A1, a compressed video data stream containing IMU data is obtained. Specifically, the compressed video data stream is a video data stream encoded and compressed based on a protocol such as H.264, and the IMU data is additional enhancement information in the encoding and compression process, which corresponds to each frame of the video data stream.
[0050] In step A2, if the inter-frame prediction information is lost during the video decoding process, the IMU data is used to perform motion estimation on the video data stream. Specifically, the use of IMU data to perform motion estimation on the video data stream specifically includes: using the acceleration in the IMU data to estimate the moving direction of the video data stream, using the angular velocity in the IMU data to estimate the rotation direction of the video data stream, calculating the motion vector of the video data stream through the moving direction and the rotation direction, and performing motion estimation based on the motion vector. The specific implementation of this step can refer to the corresponding description in step S2, which will not be repeated here.
[0051] In step A3, inter-frame prediction is performed on the original video data stream based on the result of the motion estimation, and the video data stream is decoded based on the result of the inter-frame prediction. Specifically, in the case where the inter-frame prediction information generated during the video encoding process is lost, frame loss, delay, etc. may occur, resulting in video communication quality. At this time, the motion estimation information obtained in step A2 can be used to compensate for the information loss in the inter-frame prediction and quickly calculate the content of the lost frame.
[0052] According to another aspect of the present invention, a computer storage medium is also disclosed, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in steps A1-A3 and achieves the same or similar technical effects, which will not be repeated here.
[0053] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A video encoding method using IMU data, applied to an XR device, comprising: Get the IMU data of the XR device when the original video data stream is captured. Determine whether the norms of the acceleration and angular velocity in the IMU data are greater than a certain threshold, and if not, do not use the IMU data for motion estimation; If yes, then motion estimation is performed on the original video data stream based on the IMU data, Based on the result of the motion estimation, inter-frame prediction is performed on the original video data stream, and based on the result of the inter-frame prediction, the original video data stream is compressed to obtain a compressed video data stream, wherein the inter-frame prediction is to predict a reference block from an adjacent coded image by a block to be coded in a current image; Encapsulating the IMU data and the compressed video data stream; The method further comprises: performing inter-frame prediction on the original video data stream based on the result of the motion estimation, and compressing the original video data stream based on the result of the inter-frame prediction to obtain a compressed video data stream. The result of the motion estimation is used as the initial direction of inter-frame prediction, inter-frame prediction is performed on the original video data stream, and based on the result of the inter-frame prediction, the original video data stream is compressed to obtain a compressed video data stream.
2. The method according to claim 1, wherein the performing motion estimation on the original video data stream based on the IMU data further comprises: Using the acceleration in the IMU data, estimate the direction of movement of the camera FOV, Using the angular velocity in the IMU data, estimate the rotation direction of the camera FOV. The motion vector of the camera FOV that shoots the original video data stream is calculated according to the moving direction and the rotating direction, and motion estimation is performed according to the motion vector.
3. The method according to claim 1, wherein the obtaining of IMU data when the original video data stream is shot further comprises: The IMU data within the time corresponding to each frame of the original video data stream is mean filtered, and the mean filtered IMU data is associated with each frame.
4. The method according to claim 1, further comprising: Determine whether the original video data stream contains a moving object. If so, do not use IMU data for motion estimation.
5. A video decoding method using IMU data, comprising: Get the compressed video data stream containing IMU data, If the inter-frame prediction information is lost during the video decoding process, it is determined whether the norm of the acceleration and angular velocity in the IMU data is greater than a certain threshold. If not, the IMU data is not used for motion estimation. If yes, the IMU data is used to perform motion estimation on the video data stream. Based on the result of the motion estimation, inter-frame prediction is performed on the original video data stream, and based on the result of the inter-frame prediction, the video data stream is decoded; The inter-frame prediction is to predict a block to be encoded in the current image from adjacent encoded images to obtain a reference block.
6. The method of claim 5, wherein the using IMU data to perform motion estimation on the video data stream further comprises, Using the acceleration in the IMU data, estimate the moving direction of the video data stream, Using the angular velocity in the IMU data, estimate the rotation direction of the video data stream. The motion vector of the video data stream is calculated according to the moving direction and the rotating direction, and motion estimation is performed according to the motion vector.
7. An XR device, characterized in that: The method comprises a camera, an IMU sensor, a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 4 is executed.
8. A computer storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 5 to 6.
