Inter prediction method, device and readable storage medium

By selecting motion vector prediction candidates whose errors between the current template and the reference template are ranked at a preset position in the inter-frame prediction method and performing offset processing, the problem of insufficient prediction accuracy in the prior art is solved, and higher accuracy motion vector prediction is achieved.

CN116456109BActive Publication Date: 2025-11-11VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210374666.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-01-05
Filing Date
2022-04-11
Publication Date
2025-11-11
Estimated Expiration
2042-04-11

AI Technical Summary

Technical Problem

Existing inter-frame prediction methods construct a list of motion vector prediction candidates and then perform template matching based on the motion vector prediction candidate with the smallest template selection error, resulting in insufficient prediction accuracy.

Method used

In the motion vector prediction candidate list, select multiple motion vector prediction candidates whose error between the current template and the reference template is in a preset position. After offset processing, obtain the target motion vector prediction through template matching.

Benefits of technology

It improves the accuracy of inter-frame prediction, and obtains more accurate motion vector prediction results through filtering and offset processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116456109B_ABST
    Figure CN116456109B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of communication, and particularly relates to an inter-frame prediction method, equipment and a readable storage medium. The method comprises the following steps: in a motion vector prediction candidate list of a target coding unit, a plurality of motion vector prediction candidates are determined according to a template; offset processing is performed on the plurality of motion vector prediction candidates to obtain a plurality of offset motion vector prediction candidates; a target motion vector prediction candidate is determined according to the plurality of offset motion vector prediction candidates; a target motion vector prediction is obtained through template matching by taking the target motion vector prediction candidate as a search starting point; and the plurality of motion vector prediction candidates are a plurality of motion vector prediction candidates whose errors between a current template and a reference template in the motion vector prediction candidate list are arranged in a first preset position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of communication technology, specifically relating to an inter-frame prediction method, device, and readable storage medium. Background Technology

[0002] Inter-frame prediction utilizes the temporal correlation of video to remove temporal redundancy. Since video sequences typically exhibit strong temporal correlation, many residual values ​​are close to zero. Using these residual signals as input to subsequent modules for transformation, quantization, scanning, and entropy coding enables efficient compression of the video signal. For inter-frame prediction blocks, motion parameters consist of motion vectors, reference image indices, and reference image list indices.

[0003] Current inter-frame prediction methods, after constructing a list of motion vector prediction candidates, select the motion vector prediction candidate with the smallest error between the current template and the reference template, and then perform template matching only on this motion vector prediction candidate, resulting in insufficient prediction accuracy. Summary of the Invention

[0004] This application provides an inter-frame prediction method, device, and readable storage medium, which can solve the problem of insufficient prediction accuracy in existing inter-frame prediction methods.

[0005] Firstly, an inter-frame prediction method is provided, including:

[0006] In the motion vector prediction candidate list of the target encoding / decoding unit, multiple motion vector prediction candidates are determined based on the template;

[0007] The multiple motion vector prediction candidates are offset to obtain multiple offset motion vector prediction candidates;

[0008] Target motion vector prediction candidates are determined based on the plurality of offset motion vector prediction candidates;

[0009] Using the target motion vector prediction candidates as the search starting point, the target motion vector prediction is obtained through template matching;

[0010] The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

[0011] Secondly, an inter-frame prediction apparatus is provided, comprising:

[0012] The first determining module is used to determine multiple motion vector prediction candidates from the motion vector prediction candidate list of the target encoding and decoding unit according to the template;

[0013] The offset module is used to perform offset processing on the plurality of motion vector prediction candidates to obtain a plurality of offset motion vector prediction candidates;

[0014] The second determining module is used to determine target motion vector prediction candidates based on the plurality of offset motion vector prediction candidates;

[0015] The processing module is used to obtain the target motion vector prediction by template matching, starting from the target motion vector prediction candidate.

[0016] The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

[0017] Thirdly, a terminal is provided, characterized in that it includes a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the inter-frame prediction method as described in the first aspect.

[0018] Fourthly, a terminal is provided, including a processor and a communication interface, wherein the processor is used to determine multiple motion vector prediction candidates from a motion vector prediction candidate list of a target encoding / decoding unit according to a template;

[0019] The multiple motion vector prediction candidates are offset to obtain multiple offset motion vector prediction candidates;

[0020] The target motion vector prediction candidate is determined from the plurality of offset motion vector prediction candidates;

[0021] Using the target motion vector prediction candidates as the search starting point, the target motion vector prediction is obtained through template matching;

[0022] Wherein, the plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates whose error between the current template and the reference template is ranked at a first preset position in the motion vector prediction candidate list, and the target motion vector prediction candidate is the motion vector prediction candidate whose error between the current template and the reference template is ranked at a second preset position in the plurality of offset motion vector prediction candidates.

[0023] Fifthly, a readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0024] In a sixth aspect, a chip is provided, the chip including a processor and a communication interface coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0025] In a seventh aspect, a computer program / program product is provided, the computer program / program product being stored in a storage medium, the computer program / program product being executed by at least one processor to perform the steps of the method as described in the first aspect.

[0026] In this embodiment, in the motion vector prediction candidate list of the target codec unit, multiple motion vector prediction candidates whose error between the current template and the reference template is ranked at a preset position are selected based on the template. Then, these multiple motion vector prediction candidates are offset and filtered to obtain the target motion vector prediction candidate. Finally, based on the target motion vector prediction candidate, the target motion vector prediction is obtained through template matching. The method of this embodiment can obtain more accurate motion vector prediction. Attached Figure Description

[0027] Figure 1 This is a schematic diagram of existing template matching processing;

[0028] Figure 2 A flowchart illustrating the inter-frame prediction method provided in an embodiment of this application;

[0029] Figure 3 This is a schematic diagram of the structure of the inter-frame prediction device provided in the embodiments of this application;

[0030] Figure 4 This is a schematic diagram of the terminal structure provided in an embodiment of this application. Detailed Implementation

[0031] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0032] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0033] To better understand the technical solutions of the embodiments of this application, the following content will be introduced first:

[0034] In the Versatile Video Coding (VVC) standard, an image is divided into a series of coding tree units, which are further divided into decoding units using various types of tree structures. Predicted samples for the decoding units are obtained using intra-frame prediction or inter-frame prediction. The original samples and predicted samples of the coded block are subtracted to obtain residual samples. These residual samples are then transformed and quantized to obtain residual information, which is entropy-encoded and written into the bitstream.

[0035] The decoder obtains the prediction information of the current decoding unit to be decoded from the bitstream and uses the prediction information to derive prediction samples. The residual information obtained from the bitstream is inversely quantized and transformed to obtain residual samples, which are then added to the prediction samples to obtain the reconstructed samples of the current decoding unit to be decoded.

[0036] Advanced motion vector prediction (AMVP)

[0037] Advanced motion vector prediction (APRP) is an inter-frame prediction technique that uses the spatial and temporal correlations of motion vectors between the current and neighboring blocks to save bits required for encoding motion vectors. The VVC standard offers two APRP modes: regular APRP and affine APRP.

[0038] The standard advanced motion vector prediction model constructs a motion vector prediction candidate list using the following five types of candidate orders:

[0039] 1) Prediction of spatial motion vectors of adjacent blocks in the spatial domain;

[0040] 2) Prediction of temporal motion vectors for blocks at the same temporal location;

[0041] 3) Motion vector prediction based on historical motion vectors;

[0042] 4) Pairwise average motion vector prediction;

[0043] 5) Zero motion vector;

[0044] The affine advanced motion vector prediction model constructs a motion vector prediction candidate list using the following four types of candidate orders:

[0045] 1) Infer inherited affine motion vector prediction candidates from the control point motion vectors of adjacent blocks;

[0046] 2) Construct affine motion vector prediction candidates using the translational motion vectors of adjacent blocks;

[0047] 3) Translational motion vectors from adjacent blocks;

[0048] 4) Zero motion vector;

[0049] Template matching

[0050] Template matching is a method for deriving motion vectors at the decoding end, introduced in the next-generation standard exploration experiment. For example... Figure 1 As shown, by using the template of the current image (a few rows or columns above or to the left of the current block), the best matching block (a template of the same size) can be found in a certain area of ​​the reference image, thereby optimizing the motion information of the current block.

[0051] For conventional advanced motion vector prediction models, after constructing the motion vector prediction candidate list, the candidate with the smallest error between the current template and the reference template is selected based on the template. Then, template matching is performed only on this candidate. The error referred to here is the absolute transformed differences (SATD) between the reconstructed samples of the current template and the reference template; other error calculation methods can also be used. The current module refers to the template corresponding to the current encoding / decoding unit, with the decoding unit corresponding to the coding unit (CU).

[0052] Adaptive motion vector resolution (AMVR)

[0053] Adaptive motion vector precision allows the motion vector difference (the difference between the motion vector and the motion vector prediction) to be encoded with different precisions, thus saving the number of bits required to encode the motion vector difference. In the regular motion vector prediction mode, the precision of the motion vector difference can be 1 / 4 pixel, 1 / 2 pixel, 1 pixel, and 4 pixels. In the affine advanced motion vector prediction mode, the precision of the motion vector difference can be 1 / 4 pixel, 1 pixel, and 1 / 16 pixel.

[0054] The transmission scheduling method provided in this application will be described in detail below with reference to the accompanying drawings, through some embodiments and application scenarios.

[0055] See Figure 2 This application provides an inter-frame prediction method, the execution subject of which can be a terminal or a control module in the terminal for performing terminal operations, including:

[0056] Step 201: In the motion vector prediction candidate list of the target codec unit, determine multiple motion vector prediction candidates based on the template;

[0057] It should be noted that in step 201 above, the motion vector prediction candidate list can be constructed using existing methods for constructing motion vector prediction candidate lists. However, unlike existing methods, this application selects multiple motion vector prediction candidates (which can be denoted as CandMv) from the motion vector prediction candidate list that have the smallest error between the current template and the reference template, instead of selecting only one.

[0058] Step 202: Perform offset processing on multiple motion vector prediction candidates to obtain multiple offset motion vector prediction candidates;

[0059] Step 203: Determine target motion vector prediction candidates based on multiple offset motion vector prediction candidates;

[0060] Step 204: Using the target motion vector prediction candidates as the search starting point, obtain the target motion vector prediction through template matching;

[0061] It should be noted that in step 204 above, the target motion vector prediction can be obtained by existing template matching methods, and the embodiments of this application do not specifically limit this process.

[0062] Among them, multiple motion vector prediction candidates are multiple motion vector prediction candidates whose error between the current template and the reference template is ranked in the first preset position in the motion vector prediction candidate list.

[0063] The aforementioned first preset position can refer to the last N positions, i.e., the N positions with the smallest error, or it can be the second to last, the third to last, i.e., there is no last position.

[0064] In one possible implementation, the first preset position is the N positions in the motion vector prediction candidate list that have the smallest error between the current template and the reference template, where N is an integer greater than or equal to 1;

[0065] Optionally, the two motion vector prediction candidates with the smallest error (denoted as CandMv0 and CandMv1) can be selected from the motion vector prediction candidate list, or three, four, or other numbers can be selected. This application embodiment does not specifically limit this. For the sake of convenience, the following embodiments will use the selection of the two motion vector prediction candidates with the smallest error (CandMv0 and CandMv1) as an example for illustration.

[0066] It should be noted that, in the embodiments of this application, the reference template described is specifically the template after offset for offset motion vector prediction candidates; specifically, for motion vector prediction candidates, the reference template is the template before offset.

[0067] It should be noted that, in the embodiments of this application, the method for obtaining the multiple motion vector prediction candidates with the smallest ranking can be: comparing each error with the current error, and if it is smaller, replacing the current error with the current error, and so on.

[0068] In this embodiment, in the motion vector prediction candidate list of the target encoding and decoding unit, multiple motion vector prediction candidates whose error between the current template and the reference template is ranked at a preset position are selected based on the template. Then, these multiple motion vector prediction candidates are offset and filtered to obtain the optimal target motion vector prediction candidate. Finally, based on the target motion vector prediction candidate, the target motion vector prediction is obtained through template matching. The method of this embodiment can obtain more accurate motion vector prediction.

[0069] In one possible implementation, multiple motion vector prediction candidates are offset to obtain multiple offset motion vector prediction candidates, including:

[0070] Along each of at least one preset direction, each of the multiple motion vector prediction candidates is offset by a first preset offset distance to obtain multiple first offset motion vector prediction candidates.

[0071] In the embodiments of this application, the first preset offset distance may include one or more preset offset distances. For example, multiple preset directions and multiple preset offset distances are preset. In the specific offset processing, for each motion vector prediction candidate, it is offset multiple times in each preset direction according to each preset offset distance to obtain multiple offset motion vector prediction candidates.

[0072] For example, if two preset directions (direction 1 and direction 2) and three preset offset distances (distance a, distance b, and distance c) are set in advance, and the motion vector prediction candidates are CandMv0 and CandMv1, then the offset processing process is as follows: CandMv0 is offset three times in both directions 1 and 2 according to distance a, distance b, and distance c, with each offset distance corresponding to a different distance, thus obtaining 6 offset motion vector prediction candidates. Similarly, CandMv1 is offset three times in both directions 1 and 2 according to distance a, distance b, and distance c, with each offset distance corresponding to a different distance, also obtaining 6 offset motion vector prediction candidates. In total, 12 offset motion vector prediction candidates are obtained.

[0073] In one possible implementation, the method further includes: determining a preset direction and a preset offset distance based on the value of the identifier of the current image head to be decoded.

[0074] In this embodiment, the information of the preset direction and preset offset distance can be set by the value of the flag in the current image header to be decoded. The flag can be ph_mmvd_fullpel_only_flag in the VVC standard, or ph_gpm_mmvd_table_flag in the next-generation exploration experiment, or a new flag can be added to the image header for identification.

[0075] See Table 1, which shows a preset offset distance setting:

[0076]

[0077]

[0078] Table 1

[0079] It should be noted that Table 1 provides two sets of preset offset distances, identified by flag==0 and flag==1 respectively.

[0080] It is understandable that only one set of preset offset distances can be set, in which case no flag is needed for differentiation, as shown in Table 2:

[0081] distance_idx Distance 0 1 1 2 2 4 3 8 4 12 5 16 6 24 7 32 8 64

[0082] See Table 3 for Table 2. Table 3 shows one preset direction setting:

[0083] direction_idx SignX SignY 0 +1 0 1 -1 0 2 0 +1 3 0 -1 4 +1 +1 5 +1 -1 6 -1 +1 7 -1 -1

[0084] Table 3

[0085] It should be noted that in Table 3, SignX can be understood as the X-axis direction in a conventional Cartesian coordinate system. Correspondingly, a value of +1 indicates the positive X-axis direction, and -1 indicates the negative X-axis direction. The same applies to SignY. Based on this, the preset direction corresponding to direction_idx = 0 in Table 3 is the positive X-axis direction, the preset direction corresponding to direction_idx = 4 in Table 3 is the 45° direction pointing to the first quadrant, and the preset direction corresponding to direction_idx = 6 in Table 3 is the 45° direction pointing to the second quadrant. The preset directions corresponding to other directions_idx in Table 3 can be deduced by analogy based on the same principle, and will not be elaborated here.

[0086] Furthermore, the offset for the motion vector prediction candidates is calculated as follows:

[0087] CandMvX=CandMvX+OffsetMvX;

[0088] CandMvY=CandMvY+OffsetMvY;

[0089] Among them, OffsetMvX=(Distance<<2)*SignX, OffsetMvY=(Distance<<2)*SignY;

[0090] In one possible implementation, determining target motion vector prediction candidates based on a plurality of offset motion vector prediction candidates includes:

[0091] Determine target motion vector prediction candidates from multiple first offset motion vector prediction candidates;

[0092] Alternatively, a target motion vector prediction candidate may be determined from multiple first offset motion vector prediction candidates and multiple motion vector prediction candidates.

[0093] In one possible implementation, determining a target motion vector prediction candidate from a plurality of first offset motion vector prediction candidates includes:

[0094] (1) Based on multiple first offset motion vector prediction candidates, determine the first motion vector prediction candidate. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate whose error between the current template and the reference template is ranked in the second preset position.

[0095] The aforementioned second preset position can refer to the last M positions, that is, the M positions with the smallest error.

[0096] In one possible implementation, the second preset position is the M positions with the smallest error between the current template and the reference template, where M is an integer greater than or equal to 1, for example, the last position;

[0097] (2) Along each of at least one preset direction, the first motion vector prediction candidate is offset by a second preset offset distance to obtain a second offset motion vector prediction candidate; the number of the second offset motion vector prediction candidates can be one or more.

[0098] (3) In the second offset motion vector prediction candidate, determine the target motion vector prediction candidate whose error between the current template and the reference template is ranked in the third preset position; or, in the second offset motion vector prediction candidate and the first motion vector prediction candidate, determine the target motion vector prediction candidate whose error between the current template and the reference template is ranked in the third preset position.

[0099] The aforementioned third preset position can refer to the last X position, that is, the X position with the smallest error.

[0100] In one possible implementation, the third preset position is the X positions with the smallest error between the current template and the reference template, where X is an integer greater than or equal to 1, for example, the last position;

[0101] In one possible implementation, the first preset offset distance is less than the first threshold, and the second preset offset distance is greater than or equal to the first threshold.

[0102] In one possible implementation, the error corresponding to the first offset motion vector prediction candidate is smaller than the error corresponding to the first motion vector prediction candidate.

[0103] In one possible implementation, determining a target motion vector prediction candidate from a plurality of first offset motion vector prediction candidates and a plurality of motion vector prediction candidates includes:

[0104] Among multiple first offset motion vector prediction candidates and multiple motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at the fourth preset position is determined.

[0105] The aforementioned fourth preset position can refer to the last Y position, that is, the Y position with the smallest error.

[0106] In one possible implementation, the fourth preset position is the Y positions with the smallest error between the current template and the reference template, where Y is an integer greater than or equal to 1, for example, the last position;

[0107] In this embodiment of the application, when performing offset processing on multiple motion vector prediction candidates, they are divided into two filtering methods based on a preset offset distance:

[0108] First, within a first preset offset distance less than the first threshold, offset processing is performed. Then, the first motion vector prediction candidate with the smallest first error is selected. For example, when the offset distance is less than 4 (taking the offset distance in Table 1 above as an example, other distance values ​​can also be selected according to the specific situation), offset processing is performed on CandMv0 and CandMv1. Then, the error between the current template and the reference template after offset is calculated. The candidate with the smallest error among all errors is the motion vector candidate CandMv2.

[0109] Then, within a second preset offset distance greater than or equal to the first threshold, the first motion vector prediction candidate is offset, and the error between the current template and the reference template after offset is calculated. The candidate with the smallest error among all errors is determined as the best motion vector prediction candidate, i.e., the target motion vector prediction candidate. For example, when the offset distance is greater than or equal to 4, CandMv2 is offset, and the error between the current template and the reference template after offset is calculated. The candidate with the smallest error among all errors is the target motion vector prediction candidate.

[0110] In one possible implementation, determining a target motion vector prediction candidate from a plurality of first offset motion vector prediction candidates includes:

[0111] (1) Based on multiple first offset motion vector prediction candidates, determine the first motion vector prediction candidate. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate with the smallest error between the current template and the reference template.

[0112] (2) Determine whether the first motion vector prediction candidate is equal to any one of the multiple motion vector prediction candidates; if yes, execute (3); otherwise, execute (4).

[0113] (3) Determine the first motion vector prediction candidate as the target motion vector prediction candidate;

[0114] (4) Along each of the at least one preset directions, offset the first motion vector prediction candidate by the second preset offset distance to obtain the second offset motion vector prediction candidate, and then execute (5);

[0115] (5) Among the second offset motion vector prediction candidates, determine the target motion vector prediction candidate with the smallest error between the current template and the reference template; or, among the second offset motion vector prediction candidates and the first motion vector prediction candidates, determine the target motion vector prediction candidate with the smallest error between the current template and the reference template.

[0116] In this embodiment of the application, when performing offset processing on multiple motion vector prediction candidates, they are divided into two filtering methods based on a preset offset distance:

[0117] First, within a preset offset distance less than the first threshold, offset processing is performed. Then, the first motion vector prediction candidate with the smallest first error is selected. For example, when the offset distance is less than 4 (taking the offset distance in Table 1 above as an example, other distance values ​​can also be selected according to the specific situation), offset processing is performed on CandMv0 and CandMv1. Then, the error between the current template and the reference template after offset is calculated. The candidate with the smallest error among all errors is the motion vector candidate CandMv2.

[0118] At this point, it is determined whether the first motion vector prediction candidate is equal to any one of the multiple motion vector prediction candidates; if so, the first motion vector prediction candidate is directly determined as the best motion vector prediction candidate, i.e., the target motion vector prediction candidate. For example, it is determined whether CandMv2 is equal to CandMv0 or CandMv1; if so, CandMv2 is directly determined as the best motion vector prediction candidate, i.e., the target motion vector prediction candidate.

[0119] Otherwise, within a preset offset distance greater than or equal to the first threshold, the first motion vector prediction candidate is offset, and the error between the current template and the offset reference template is calculated. The candidate with the smallest error is determined as the best motion vector prediction candidate, i.e., the target motion vector prediction candidate. For example, if the offset distance is greater than or equal to 4, CandMv2 is offset, and then the error between the current template and the offset reference template is calculated. The candidate with the smallest error is the target motion vector prediction candidate.

[0120] In one possible implementation, the first preset offset distance is the offset distance included in a preset set of predicted offset distances, the second preset offset distance is at least one offset distance associated with the target offset distance, and the target offset distance is the first preset offset distance corresponding to the first motion vector prediction candidate.

[0121] In this embodiment, a pre-set set of predicted offset distances is provided to characterize the mapping relationship between indices and offset distances. It should be understood that `distance_idx` in Tables 1 and 2 represents an index, and `Distance` in Tables 1 and 2 represents an offset distance. The predicted offset distance set can be configured as a mapping relationship between a subset of indices and offset distances included in Tables 1 and 2. For example, if the predicted offset distance set includes the offset distances corresponding to all even-numbered indices in Table 2, then by referring to Table 2, the first preset offset distances are 1, 4, 12, 24, and 64.

[0122] As described above, after selecting the two motion vector prediction candidates (CandMv0 and CandMv1) with the smallest error, CandMv0 and CandMv1 are offset according to the first preset offset distance. Then, the error between the current template and the reference template after offset is calculated. The candidate with the smallest error is the motion vector candidate CandMv2. The first preset offset distance corresponding to CandMv2 is determined as the target offset distance.

[0123] In this embodiment, the second preset offset distance associated with the target offset distance can be determined by consulting Tables 1 and 2. For example, if the target offset distance is 4, and the index corresponding to the target offset distance in Table 2 is 2, then the offset distances corresponding to the indices adjacent to index 2 in Table 2 can be set as the second preset offset distances, that is, the offset distances corresponding to indices 1 and 3 can be set as the second preset offset distances, which are 2 and 8.

[0124] According to the second preset offset distance mentioned above, CandMv2 is offset, and then the error between the current template and the reference template after offset is calculated. The candidate with the smallest error is the target motion vector prediction candidate.

[0125] In an optional implementation, after determining the target offset distance, it is determined whether the first motion vector prediction candidate is equal to any one of the multiple motion vector prediction candidates, that is, whether CandMv2 is equal to CandMv0 or CandMv1. If they are equal, CandMv2 is determined as the target motion vector prediction candidate; if they are not equal, the above-described offset processing of CandMv2 is performed to determine the target motion vector prediction candidate.

[0126] In this embodiment, a prediction offset distance set is preset, and motion vector prediction candidates are offset according to a first preset offset distance included in the prediction offset distance set; and after determining the motion vector candidates, a second preset offset distance is used to offset the motion vector candidates to determine the target motion vector prediction candidate. In the above process, the number of offset processing operations on the motion vector prediction candidates and the motion vector candidates is reduced, thereby improving the efficiency of inter-frame prediction.

[0127] In one possible implementation, the motion vector accuracy of multiple offset motion vector prediction candidates is equal to the motion vector accuracy of the target encoding / decoding unit.

[0128] It should be noted that the motion vector precision of the aforementioned offset motion vector prediction candidate is equal to that of the target codec unit. Specifically, the motion vector precision of the offset motion vector prediction candidate is equal to the motion vector precision of the target codec unit after rounding.

[0129] The specific rounding process for motion vector precision is as follows:

[0130] If rightShift equals 0, then offset is assigned the value 0; otherwise, offset is assigned the value (1 << (rightShift - 1)) - 1).

[0131] mv[0]=Sign(mvX[0])*(((Abs(mvX[0])+offset)>>rightShift)< <leftShift);

[0132] mv[1]=Sign(mvX[1])*(((Abs(mvX[1])+offset)>>rightShift)< <leftShift);

[0133] Among them, the right shift value `rightShift` and the left shift value `leftShift` are both equal to `AmvrShift`. `AmvrShift` can be found in Table 4:

[0134] Table 4

[0135]

[0136] In one possible implementation, the motion vector precision of the target encoding / decoding unit satisfies a preset motion vector precision, which may be 1 / 4 pixel precision, 1 pixel precision, or other precision.

[0137] It should be noted that in some specific implementation processes, when the motion vector accuracy of the target encoding / decoding unit meets the preset motion vector accuracy, the inter-frame prediction method of the present application embodiment is adopted.

[0138] In one possible implementation, the target information of the target encoding / decoding unit satisfies a preset threshold value, the target information including at least one of area, width, and height.

[0139] In one possible implementation, the method further includes:

[0140] Based on the value of the identifier of the image header to be decoded, at least one of the preset direction, the first preset offset distance, and the second preset offset distance is determined.

[0141] It should be noted that in some specific implementation processes, when the width and / or height of the target encoding / decoding unit meet the preset threshold value, the inter-frame prediction method of the present application embodiment is adopted.

[0142] The inter-frame prediction method provided in this application can be executed by an inter-frame prediction device. This application uses an inter-frame prediction device executing the inter-frame prediction method as an example to illustrate the inter-frame prediction device provided in this application.

[0143] See Figure 3 This application provides an inter-frame prediction device 300, comprising:

[0144] The first determining module 301 is used to determine multiple motion vector prediction candidates from the motion vector prediction candidate list of the target encoding and decoding unit according to the template;

[0145] The offset module 302 is used to perform offset processing on the plurality of motion vector prediction candidates to obtain a plurality of offset motion vector prediction candidates;

[0146] The second determining module 303 is used to determine target motion vector prediction candidates based on the plurality of offset motion vector prediction candidates;

[0147] Processing module 304 is used to obtain target motion vector predictions by template matching, starting from the target motion vector prediction candidates.

[0148] The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

[0149] In one possible implementation, the first preset position is the N positions in the motion vector prediction candidate list that have the smallest error between the current template and the reference template, where N is an integer greater than or equal to 1.

[0150] In one possible implementation, the offset module is specifically used for:

[0151] Along each of at least one preset direction, each of the plurality of motion vector prediction candidates is offset by a first preset offset distance to obtain the plurality of first offset motion vector prediction candidates;

[0152] The second determining module is specifically used for:

[0153] A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates; or,

[0154] A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates.

[0155] In one possible implementation, the second determining module is specifically used for:

[0156] Based on the plurality of first offset motion vector prediction candidates, a first motion vector prediction candidate is determined. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate whose error between the current template and the reference template is ranked in the second preset position.

[0157] Along each of at least one preset direction, the first motion vector prediction candidate is offset by a second preset offset distance to obtain a second offset motion vector prediction candidate;

[0158] Among the second offset motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined; or, among the second offset motion vector prediction candidates and the first motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined.

[0159] In one possible implementation, the first preset offset distance is less than a first threshold, and the second preset offset distance is greater than or equal to the first threshold.

[0160] In one possible implementation, the first preset offset distance is an offset distance included in a preset set of predicted offset distances, and the second preset offset distance is at least one offset distance associated with a target offset distance, wherein the target offset distance is the first preset offset distance corresponding to the first motion vector prediction candidate.

[0161] In one possible implementation, the error corresponding to the first offset motion vector prediction candidate is smaller than the error corresponding to the first motion vector prediction candidate.

[0162] In one possible implementation, the second determining module is specifically used for:

[0163] Among the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at the fourth preset position is determined.

[0164] In one possible implementation, the motion vector accuracy of the plurality of offset motion vector prediction candidates is equal to the motion vector accuracy of the target encoding / decoding unit.

[0165] In one possible implementation, the motion vector accuracy of the target encoding / decoding unit meets a preset motion vector accuracy.

[0166] In one possible implementation, the target information of the target encoding / decoding unit satisfies a preset threshold value, and the target information includes at least one of area, width, and height.

[0167] In one possible implementation, the device further includes:

[0168] The third determining module is used to determine at least one of the preset direction, the first preset offset distance, and the second preset offset distance based on the value of the identifier of the current image head to be decoded.

[0169] In this embodiment, in the motion vector prediction candidate list of the target encoding and decoding unit, multiple motion vector prediction candidates whose error between the current template and the reference template is ranked at a preset position are selected based on the template. Then, these multiple motion vector prediction candidates are offset and filtered to obtain the optimal target motion vector prediction candidate. Finally, based on the target motion vector prediction candidate, the target motion vector prediction is obtained through template matching. The method of this embodiment can obtain more accurate motion vector prediction.

[0170] The inter-frame prediction device in this application embodiment can be an electronic device, such as an electronic device with an operating system, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a server, network attached storage (NAS), etc., and this application embodiment does not specifically limit it.

[0171] The inter-frame prediction device provided in this application embodiment can achieve... Figure 2 The various processes implemented in the method embodiments achieve the same technical effect, and will not be described again here to avoid repetition.

[0172] Specifically, Figure 4 A schematic diagram of the hardware structure of a terminal to implement an embodiment of this application.

[0173] The terminal 400 includes, but is not limited to, at least some of the following components: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, and processor 410.

[0174] Those skilled in the art will understand that the terminal 400 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 410 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 4 The terminal structure shown does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0175] It should be understood that, in this embodiment, the input unit 404 may include a graphics processing unit (GPU) 4041 and a microphone 4042. The GPU 4041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 406 may include a display panel 4061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 407 includes at least one of a touch panel 4071 and other input devices 4072. The touch panel 4071 is also called a touch screen. The touch panel 4071 may include a touch detection device and a touch controller. Other input devices 4072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0176] In this embodiment, after receiving downlink data from the network-side device, the radio frequency unit 401 can transmit it to the processor 410 for processing; in addition, the radio frequency unit 401 can send uplink data to the network-side device. Typically, the radio frequency unit 401 includes, but is not limited to, antennas, amplifiers, transceivers, couplers, low-noise amplifiers, duplexers, etc.

[0177] The memory 409 can be used to store software programs or instructions, as well as various data. The memory 409 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 409 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 409 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0178] Processor 410 may include one or more processing units; optionally, processor 410 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor x10.

[0179] The processor 410 is used to determine multiple motion vector prediction candidates from the motion vector prediction candidate list of the target encoding / decoding unit based on the template.

[0180] Processor 410 is used to perform offset processing on the plurality of motion vector prediction candidates to obtain a plurality of offset motion vector prediction candidates;

[0181] Processor 410 is configured to determine target motion vector prediction candidates based on the plurality of offset motion vector prediction candidates;

[0182] Processor 410 is configured to obtain target motion vector predictions by template matching, using the target motion vector prediction candidates as the search starting point;

[0183] The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

[0184] In one possible implementation, the first preset position is the N positions in the motion vector prediction candidate list that have the smallest error between the current template and the reference template, where N is an integer greater than or equal to 1.

[0185] In one possible implementation, the processor 410 is specifically used for:

[0186] Along each of at least one preset direction, each of the plurality of motion vector prediction candidates is offset by a first preset offset distance to obtain the plurality of first offset motion vector prediction candidates;

[0187] The processor 410 is specifically used for:

[0188] A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates; or,

[0189] A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates.

[0190] In one possible implementation, the processor 410 is specifically used for:

[0191] Based on the plurality of first offset motion vector prediction candidates, a first motion vector prediction candidate is determined. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate whose error between the current template and the reference template is ranked in the second preset position.

[0192] Along each of at least one preset direction, the first motion vector prediction candidate is offset by a second preset offset distance to obtain a second offset motion vector prediction candidate;

[0193] Among the second offset motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined; or, among the second offset motion vector prediction candidates and the first motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined.

[0194] In one possible implementation, the first preset offset distance is less than a first threshold, and the second preset offset distance is greater than or equal to the first threshold.

[0195] In one possible implementation, the first preset offset distance is an offset distance included in a preset set of predicted offset distances, and the second preset offset distance is at least one offset distance associated with a target offset distance, wherein the target offset distance is the first preset offset distance corresponding to the first motion vector prediction candidate.

[0196] In one possible implementation, the error corresponding to the first offset motion vector prediction candidate is smaller than the error corresponding to the first motion vector prediction candidate.

[0197] In one possible implementation, the processor 410 is specifically used for:

[0198] Among the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at the fourth preset position is determined.

[0199] In one possible implementation, the motion vector accuracy of the plurality of offset motion vector prediction candidates is equal to the motion vector accuracy of the target encoding / decoding unit.

[0200] In one possible implementation, the motion vector accuracy of the target encoding / decoding unit meets a preset motion vector accuracy.

[0201] In one possible implementation, the target information of the target encoding / decoding unit satisfies a preset threshold value, and the target information includes at least one of area, width, and height.

[0202] In one possible implementation, the processor 410 is configured to determine at least one of the preset direction, the first preset offset distance, and the second preset offset distance based on the value of the identifier of the current image head to be decoded.

[0203] In this embodiment, in the motion vector prediction candidate list of the target encoding and decoding unit, multiple motion vector prediction candidates whose error between the current template and the reference template is ranked at a preset position are selected based on the template. Then, these multiple motion vector prediction candidates are offset and filtered to obtain the optimal target motion vector prediction candidate. Finally, based on the target motion vector prediction candidate, the target motion vector prediction is obtained through template matching. The method of this embodiment can obtain more accurate motion vector prediction.

[0204] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0205] The processor is the processor in the terminal described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0206] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described inter-frame prediction method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0207] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0208] This application also provides a computer program / program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described inter-frame prediction method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0209] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0210] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0211] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An inter-frame prediction method, characterized in that, include: In the motion vector prediction candidate list of the target encoding / decoding unit, multiple motion vector prediction candidates are determined based on the template; The multiple motion vector prediction candidates are offset to obtain multiple offset motion vector prediction candidates; Target motion vector prediction candidates are determined based on the plurality of offset motion vector prediction candidates; Using the target motion vector prediction candidates as the search starting point, the target motion vector prediction is obtained through template matching; The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

2. The method according to claim 1, characterized in that, The first preset position is the N positions in the motion vector prediction candidate list that have the smallest error between the current template and the reference template, where N is an integer greater than 1.

3. The method according to claim 1, characterized in that, The multiple motion vector prediction candidates are offset to obtain multiple offset motion vector prediction candidates, including: Along each of the at least one preset direction, each of the plurality of motion vector prediction candidates is offset by a first preset offset distance to obtain a plurality of first offset motion vector prediction candidates; Determining target motion vector prediction candidates based on the plurality of offset motion vector prediction candidates includes: A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates; or, A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates.

4. The method according to claim 3, characterized in that, The step of determining the target motion vector prediction candidate from the plurality of first offset motion vector prediction candidates includes: Based on the plurality of first offset motion vector prediction candidates, a first motion vector prediction candidate is determined. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate whose error between the current template and the reference template is ranked in the second preset position. Along each of at least one preset direction, the first motion vector prediction candidate is offset by a second preset offset distance to obtain a second offset motion vector prediction candidate; Among the second offset motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined; or, among the second offset motion vector prediction candidates and the first motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined.

5. The method according to claim 4, characterized in that, The first preset offset distance is less than the first threshold, and the second preset offset distance is greater than or equal to the first threshold.

6. The method according to claim 4, characterized in that, The first preset offset distance is the offset distance included in the preset set of predicted offset distances, the second preset offset distance is at least one offset distance associated with the target offset distance, and the target offset distance is the first preset offset distance corresponding to the first motion vector prediction candidate.

7. The method according to claim 4, characterized in that, The error corresponding to the first offset motion vector prediction candidate is smaller than the error corresponding to the first motion vector prediction candidate.

8. The method according to claim 3, characterized in that, Determining a target motion vector prediction candidate from the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates includes: Among the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at the fourth preset position is determined.

9. The method according to claim 1, characterized in that, The motion vector accuracy of the multiple offset motion vector prediction candidates is equal to the motion vector accuracy of the target encoding / decoding unit.

10. The method according to claim 1, characterized in that, The motion vector accuracy of the target encoding / decoding unit meets the preset motion vector accuracy.

11. The method according to claim 1, characterized in that, The target information of the target encoding / decoding unit satisfies a preset threshold value, and the target information includes at least one of area, width, and height.

12. The method according to claim 4, characterized in that, The method further includes: Based on the value of the identifier of the image header to be decoded, at least one of the preset direction, the first preset offset distance, and the second preset offset distance is determined.

13. An inter-frame prediction device, characterized in that, include: The first determining module is used to determine multiple motion vector prediction candidates from the motion vector prediction candidate list of the target encoding and decoding unit according to the template; The offset module is used to perform offset processing on the plurality of motion vector prediction candidates to obtain a plurality of offset motion vector prediction candidates; The second determining module is used to determine target motion vector prediction candidates based on the plurality of offset motion vector prediction candidates; The processing module is used to obtain the target motion vector prediction by template matching, starting from the target motion vector prediction candidate. The plurality of motion vector prediction candidates are the plurality of motion vector prediction candidates in the motion vector prediction candidate list whose error between the current template and the reference template is ranked in the first preset position.

14. The apparatus according to claim 13, characterized in that, The first preset position is the N positions in the motion vector prediction candidate list that have the smallest error between the current template and the reference template, where N is an integer greater than 1.

15. The apparatus according to claim 13, characterized in that, The offset module is specifically used for: Along each of the at least one preset direction, each of the plurality of motion vector prediction candidates is offset by a first preset offset distance to obtain a plurality of first offset motion vector prediction candidates; The second determining module is specifically used for: A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates; or, A target motion vector prediction candidate is determined from the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates.

16. The apparatus according to claim 15, characterized in that, The second determining module is specifically used for: Based on the plurality of first offset motion vector prediction candidates, a first motion vector prediction candidate is determined. The first motion vector prediction candidate is the motion vector prediction candidate corresponding to the first offset motion vector prediction candidate whose error between the current template and the reference template is ranked in the second preset position. Along each of at least one preset direction, the first motion vector prediction candidate is offset by a second preset offset distance to obtain a second offset motion vector prediction candidate; In the second offset motion vector prediction candidate, the target motion vector prediction candidate whose error between the current template and the reference template is ranked in the third preset position is determined; Alternatively, among the second offset motion vector prediction candidate and the first motion vector prediction candidate, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at a third preset position is determined.

17. The apparatus according to claim 16, characterized in that, The first preset offset distance is less than the first threshold, and the second preset offset distance is greater than or equal to the first threshold.

18. The apparatus according to claim 16, characterized in that, The first preset offset distance is the offset distance included in the preset set of predicted offset distances, the second preset offset distance is at least one offset distance associated with the target offset distance, and the target offset distance is the first preset offset distance corresponding to the first motion vector prediction candidate.

19. The apparatus according to claim 16, characterized in that, The error corresponding to the first offset motion vector prediction candidate is smaller than the error corresponding to the first motion vector prediction candidate.

20. The apparatus according to claim 15, characterized in that, The second determining module is specifically used for: Among the plurality of first offset motion vector prediction candidates and the plurality of motion vector prediction candidates, the target motion vector prediction candidate whose error between the current template and the reference template is ranked at the fourth preset position is determined.

21. The apparatus according to claim 13, characterized in that, The motion vector accuracy of the multiple offset motion vector prediction candidates is equal to the motion vector accuracy of the target encoding / decoding unit.

22. The apparatus according to claim 13, characterized in that, The motion vector accuracy of the target encoding / decoding unit meets the preset motion vector accuracy.

23. The apparatus according to claim 13, characterized in that, The target information of the target encoding / decoding unit satisfies a preset threshold value, and the target information includes at least one of area, width, and height.

24. The apparatus according to claim 16, characterized in that, The device further includes: The third determining module is used to determine at least one of the preset direction, the first preset offset distance, and the second preset offset distance based on the value of the identifier of the current image head to be decoded.

25. A terminal, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the inter-frame prediction method as described in any one of claims 1 to 12.

26. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the inter-frame prediction method as described in any one of claims 1 to 12.