Nothing Special   »   [go: up one dir, main page]

CN118200585A - Model updating method, device, electronic equipment and computer readable storage medium - Google Patents

Model updating method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN118200585A
CN118200585A CN202410309590.XA CN202410309590A CN118200585A CN 118200585 A CN118200585 A CN 118200585A CN 202410309590 A CN202410309590 A CN 202410309590A CN 118200585 A CN118200585 A CN 118200585A
Authority
CN
China
Prior art keywords
binary symbol
probability
model
frame
updating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410309590.XA
Other languages
Chinese (zh)
Inventor
吕卓逸
朴银姬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Samsung Electronics Co Ltd
Original Assignee
Samsung Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Samsung Electronics Co Ltd filed Critical Samsung Electronics Co Ltd
Publication of CN118200585A publication Critical patent/CN118200585A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Feedback Control In General (AREA)

Abstract

The embodiment of the application provides a model updating method, a model updating device, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. The method comprises the following steps: obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded, wherein the first parameters corresponding to the binary symbol model comprise: and updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models. The embodiment of the application can save the storage space occupied by the parameters for updating the model.

Description

Model updating method, device, electronic equipment and computer readable storage medium
The application is a divisional application of an application patent application with the application number of 202010152701.2, the application date of 2020, 03 and 06, and the application name of model updating method, device, electronic equipment and computer readable storage medium.
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for updating a model, an electronic device, and a computer readable storage medium.
Background
In existing Video Coding, for example, the second algebraic audio Video codec standard (Audio Video Coding Standard, avs 2), h.264/AVC and High Efficiency Video Coding (HEVC), the Context-based adaptive binary arithmetic Coding (CABAC) method is used to entropy encode binary symbol strings after binarizing syntax elements to further increase the compression rate.
Since the probability distribution of each binary symbol in a binary symbol string is dynamically distributed according to different coding parameters and the content of the input video source, a binary symbol model needs to be stored and maintained. For next generation video coding (VERSATILE VIDEO CODING, VVC), a coded image may be divided into one or more frames, each frame containing 702 binary symbol models, the 702 binary symbol models defined in advance need to be loaded into memory before any frame is encoded and then the probability of the current binary symbol is estimated by the information in the binary symbol models, the information in the binary symbol models is updated according to the current binary symbol information, and the update speed of the binary symbol models is controlled by the probability update speed parameter (e.g., right displacement number), wherein the binary symbol model corresponding to the binary symbol may be referred to as a binary symbol model.
However, storing the probability update speed parameter in the binary symbol model requires a larger memory space, and each frame of image includes multiple binary symbol models, which may result in a need to occupy more memory space, for example, using 8 bits for each binary symbol model to store the probability update speed parameter, for example, a right shift number, and each frame of image includes 702 binary symbol models, and thus each frame of image needs to occupy 8×702 bits of memory space, which results in a larger memory space.
Disclosure of Invention
The application provides a model updating method, a model updating device, electronic equipment and a computer readable storage medium, which are used for solving the problem that the storage space occupied by parameters for updating a model is large.
In a first aspect, a method for updating a model is provided, the method comprising:
Obtaining first parameters corresponding to each binary symbol model corresponding to a current frame to be coded, wherein the first parameters corresponding to the binary symbol model comprise: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
and updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models.
In one possible implementation manner, the first parameter corresponding to the binary symbol model further includes: related information of probability update times;
the related information of the probability update times includes the binary symbol model probability update times and a threshold value of the probability update times.
Another possible implementation manner, the manner of obtaining the threshold value of the probability update times includes:
determining coding information of a current frame to be decoded;
and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
In another possible implementation manner, the obtaining the first parameters corresponding to each binary symbol model corresponding to the current frame to be encoded includes:
and obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be coded, which is defined in advance.
In another possible implementation manner, the obtaining the first parameters corresponding to the binary symbol models corresponding to the current frame to be encoded, and then further includes:
and storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner, storing the first parameters corresponding to each binary symbol model respectively includes:
and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model corresponding to the current frame to be coded into the storage space occupied by each binary symbol model.
In another possible implementation manner, storing the first parameters corresponding to each binary symbol model respectively includes:
and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model into the memory corresponding to the binary symbol model.
In another possible implementation manner, storing the first parameters corresponding to each binary symbol model respectively includes:
If at least one relevant information corresponding to each binary symbol model is the same, the same at least one relevant information is stored as a frame level parameter to a frame level layer, and the at least one relevant information is the relevant information of the difference between the at least one probability updating speed parameter and the basic probability updating speed parameter and the relevant information of the probability updating times.
In another possible implementation manner, updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models includes:
acquiring a basic probability updating speed parameter;
based on the first parameters respectively corresponding to the binary symbol models and the acquired basic probability update speed parameters, determining the second parameters respectively corresponding to the binary symbol models, wherein the second parameters corresponding to the binary symbol models comprise: at least one probability update rate parameter;
and updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
Another possible implementation manner, obtaining the basic probability update speed parameter includes:
determining coding information of a current frame to be coded;
And acquiring a basic probability updating speed parameter based on the coding information of the current frame to be coded.
In another possible implementation manner, the coding information of the current frame to be coded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; picture order count (picture order count, POC); a coding configuration; group of pictures (GOP) structure.
In another possible implementation manner, the method further includes: and writing the basic probability updating speed parameter into the code stream.
In another possible implementation manner, the first parameters corresponding to each binary symbol model corresponding to the current frame to be encoded are obtained, where the first parameters include at least one of the following:
Acquiring first parameters of each binary symbol model corresponding to a current frame to be encoded from first parameters of each binary symbol model corresponding to each binary symbol model predefined by an encoder;
and acquiring respective predefined first parameters from each predefined binary symbol model corresponding to the current frame to be coded.
In another possible implementation manner, the method further includes:
any relevant information corresponding to each binary symbol model comprises at least one of the following relations:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be coded respectively comprise at least one of the following relations:
the basic probability model parameters corresponding to the frames to be coded are different;
The parameters of the basic probability models corresponding to at least two frames to be coded are the same.
In another possible implementation manner, the storage space occupied by the related information of the difference value between any probability update speed parameter corresponding to any binary symbol model and the basic probability update speed parameter is 2 bits or 3 bits or 1 bit.
In another possible implementation, the information about the difference between at least the probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
In another possible implementation manner, the first parameters corresponding to each binary symbol model are stored, including at least one of the following:
Storing first parameters corresponding to the binary symbol models into memories corresponding to the binary symbol models;
and storing the first parameters corresponding to the binary symbol models into the memories occupied by the models.
In another possible implementation, the second parameter corresponding to any binary symbol model includes two probability update speed parameters: a first probability update rate parameter for updating a first probability of the binary symbol model and a second probability update rate parameter for updating a second probability of the binary symbol model; the threshold for the number of probability updates in the first parameter of any binary symbol model includes: a first probability update times threshold and a second probability update times threshold, the second probability update times threshold not being less than the first probability update times threshold;
Wherein updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models comprises:
Updating at least one of a first probability of the corresponding binary symbol model and a second probability of the binary symbol model based on the second parameters respectively corresponding to the binary symbol models and the threshold values of the respective corresponding probability updating times;
And updating the corresponding binary symbol model based on the updated first probability and/or the updated second probability respectively corresponding to the binary symbol models.
Another possible implementation manner, updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the second parameter corresponding to any binary symbol model and the threshold value of the corresponding probability update times, includes:
determining whether to update the first probability of the binary symbol model and/or the second probability of the binary symbol model based on the magnitude relation between the probability update times corresponding to the binary symbol model and the second probability update times threshold;
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the determined result and the second parameter corresponding to any binary symbol model.
In a second aspect, there is provided a model updating apparatus including:
The first obtaining module is configured to obtain first parameters corresponding to respective binary symbol models corresponding to a current frame to be encoded, where the first parameters corresponding to the binary symbol models include: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
and the first updating module is used for updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models.
In one possible implementation manner, the first parameter corresponding to the binary symbol model further includes: related information of probability update times;
The information on the number of probability updates includes: the number of probability updates and the threshold value of the number of probability updates.
In another possible implementation manner, the first obtaining module is specifically configured to, when obtaining the threshold value of the probability update times:
determining coding information of a current frame to be decoded;
and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
In another possible implementation manner, the first obtaining module is specifically configured to, when obtaining first parameters corresponding to respective binary symbol models corresponding to a current frame to be encoded, respectively:
and obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be coded, which is defined in advance.
In another possible implementation manner, the apparatus further includes: a first memory module, wherein,
And the first storage module is used for storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner, the first storage module is specifically configured to store, when initializing each binary symbol model, first parameters corresponding to each binary symbol model corresponding to a current frame to be encoded in a storage space occupied by each binary symbol model.
In another possible implementation manner, the first storage module is specifically configured to store, when at least one piece of relevant information corresponding to each binary symbol model is the same, the same at least one piece of relevant information as a frame level parameter to a frame level layer, where the at least one piece of relevant information is relevant information of a difference between at least one probability update speed parameter and a basic probability update speed parameter, and relevant information of a probability update number.
The first storage module is specifically configured to, when storing the first parameters corresponding to the binary symbol models respectively:
and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model into the memory corresponding to the binary symbol model.
In another possible implementation manner, the first updating module includes: a first acquisition unit, a first determination unit and a first updating unit, wherein,
The first acquisition unit is used for acquiring the basic probability update speed parameter;
The first determining unit is configured to determine, based on the first parameters respectively corresponding to the binary symbol models and the obtained basic probability update speed parameters, second parameters respectively corresponding to the binary symbol models, where the second parameters corresponding to any binary symbol model include: at least one probability update rate parameter;
And the first updating unit is used for updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In another possible implementation manner, the first obtaining unit is specifically configured to determine coding information of a current frame to be coded, and obtain the basic probability update speed parameter based on the coding information of the current frame to be coded.
In another possible implementation manner, the coding information of the current frame to be coded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; image order count, POC; a coding configuration; group of pictures GOP structure.
In another possible implementation manner, the apparatus further includes: a write module, wherein,
And the writing module is used for writing the basic probability updating speed parameter into the code stream.
In another possible implementation manner, the first obtaining module is specifically configured to obtain, from first parameters corresponding to respective binary symbol models predefined by the encoder, respective first parameters corresponding to respective binary symbol models corresponding to the current frame to be encoded, and/or obtain, from respective predefined binary symbol models corresponding to the current frame to be encoded, respective first parameters predefined by the encoder.
In another possible implementation manner, the apparatus further includes:
any relevant information corresponding to each binary symbol model comprises at least one of the following relations:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be coded respectively comprise at least one of the following relations:
the basic probability model parameters corresponding to the frames to be coded are different;
The parameters of the basic probability models corresponding to at least two frames to be coded are the same.
In another possible implementation manner, the storage space occupied by the related information of the difference value between any probability update speed parameter corresponding to any binary symbol model and the basic probability update speed parameter is 2 bits or 3 bits or 1 bit.
In another possible implementation, the information about the difference between at least the probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
In another possible implementation, the second parameter corresponding to any binary symbol model includes two probability update speed parameters: a first probability update rate parameter for updating a first probability of the binary symbol model and a second probability update rate parameter for updating a second probability of the binary symbol model; the threshold for the number of probability updates in the first parameter of any binary symbol model includes: a first probability update times threshold and a second probability update times threshold, the second probability update times threshold not being less than the first probability update times threshold;
the first updating unit is specifically configured to, when updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models:
Updating at least one of a first probability of the corresponding binary symbol model and a second probability of the binary symbol model based on the second parameters respectively corresponding to the binary symbol models and the threshold values of the respective corresponding probability updating times;
And updating the corresponding binary symbol model based on the updated first probability and/or the updated second probability respectively corresponding to the binary symbol models.
In another possible implementation manner, the first updating unit is specifically configured to, when updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the second parameter corresponding to any binary symbol model and the threshold value of the corresponding probability update times:
determining whether to update the first probability of the binary symbol model and/or the second probability of the binary symbol model based on the magnitude relation between the probability update times corresponding to the binary symbol model and the second probability update times threshold;
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the determined result and the second parameter corresponding to any binary symbol model.
In a third aspect, an electronic device is provided, comprising:
one or more processors;
A memory;
one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: and executing the operation corresponding to the model updating method shown in the first aspect.
In a fourth aspect, a computer readable storage medium is provided, the storage medium storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, at least one program, code set, or instruction set being loaded and executed by a processor to implement the model updating method as shown in the first aspect.
In a fifth aspect, a method for updating a model is provided, including:
Obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded, wherein the first parameters corresponding to the binary symbol model comprise: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
and updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models.
In one possible implementation manner, the first parameter corresponding to the binary symbol model further includes: related information of probability update times;
The information on the number of probability updates includes: the number of probability updates and the threshold value of the number of probability updates.
Another possible implementation manner, the manner of obtaining the threshold value of the probability update times includes:
determining coding information of a current frame to be decoded;
and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
One possible implementation manner, obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded, and then further includes:
and storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner, storing the first parameters corresponding to each binary symbol model respectively includes:
And when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded into the storage space occupied by each binary symbol model.
In another possible implementation manner, storing the first parameters corresponding to each binary symbol model respectively includes:
If at least one relevant information corresponding to each binary symbol model is the same, the same at least one relevant information is stored as a frame level parameter to a frame level layer, and the at least one relevant information is the relevant information of the difference between the at least one probability updating speed parameter and the basic probability updating speed parameter and the relevant information of the probability updating times.
In another possible implementation manner, updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models includes:
acquiring a basic probability updating speed parameter;
Based on the first parameters respectively corresponding to the binary symbol models and the acquired basic probability updating speed parameters stored in the memory, determining the second parameters respectively corresponding to the binary symbol models, wherein the second parameters corresponding to the binary symbol models comprise: at least one probability update rate parameter;
and updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In another possible implementation manner, the acquiring basic probability update speed parameter includes at least one of:
Acquiring basic probability updating speed parameters from a code stream;
and acquiring a basic probability updating speed parameter based on the coding information of the current frame to be decoded.
In another possible implementation manner, the coding information of the current frame to be decoded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; image order count, POC; a coding configuration; group of pictures GOP structure.
In another possible implementation manner, the obtaining the first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded includes at least one of the following:
Acquiring first parameters of each binary symbol model corresponding to a current frame to be decoded from first parameters of each binary symbol model corresponding to each binary symbol model predefined by a decoder;
And respectively acquiring the respective predefined first parameters from each predefined binary symbol model corresponding to the current frame to be decoded.
In another possible implementation manner, the method further includes:
any relevant information corresponding to each binary symbol model comprises at least one of the following relations:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be decoded respectively comprise at least one of the following relations:
The basic probability model parameters corresponding to the frames to be decoded are different;
the basic probability model parameters corresponding to at least two frames to be decoded are the same.
In another possible implementation manner, the storage space occupied by the related information of the difference value between any probability update speed parameter corresponding to any binary symbol model and the basic probability update speed parameter is 2 bits or 3 bits or 1 bit.
In another possible implementation, the information about the difference between at least the probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
In a sixth aspect, there is provided a model updating apparatus including:
The second obtaining module is configured to obtain first parameters corresponding to respective binary symbol models corresponding to a current frame to be decoded, where the first parameters corresponding to the binary symbol models include: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
And the second updating module is used for updating the corresponding binary symbol models based on the first parameters respectively corresponding to the binary symbol models.
In one possible implementation manner, the first parameter corresponding to the binary symbol model further includes: related information of probability update times;
The information on the number of probability updates includes: the number of probability updates and the threshold value of the number of probability updates.
In another possible implementation manner, the second obtaining module is specifically configured to, when obtaining the threshold value of the probability update times:
determining coding information of a current frame to be decoded;
and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
In another possible implementation manner, the apparatus further includes: a second memory module, wherein,
And the second storage module is used for storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner, the second storage module is specifically configured to store, when initializing each binary symbol model, first parameters corresponding to each binary symbol model corresponding to a current frame to be decoded into storage spaces occupied by each binary symbol model.
In another possible implementation manner, the second storage module is specifically configured to store, when at least one piece of relevant information corresponding to each binary symbol model is the same, the same at least one piece of relevant information as a frame level parameter to a frame level layer, where the at least one piece of relevant information is relevant information of a difference between the at least one probability update speed parameter and the basic probability update speed parameter.
In another possible implementation manner, the second updating module includes: a second acquisition unit, a second determination unit, and a second update unit, wherein,
The second acquisition unit is used for acquiring the basic probability update speed parameter;
The second determining unit is configured to determine, based on the first parameters respectively corresponding to the binary symbol models stored in the memory and the obtained basic probability update speed parameters, second parameters respectively corresponding to the binary symbol models, where the second parameters corresponding to the binary symbol models include: at least one probability update rate parameter;
And the second updating unit is used for updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In another possible implementation manner, the second obtaining unit is specifically configured to obtain the basic probability update speed parameter from the code stream, and/or obtain the basic probability update speed parameter based on the coding information of the current frame to be decoded.
In another possible implementation manner, the coding information of the current frame to be decoded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; image order count, POC; a coding configuration; group of pictures GOP structure.
In another possible implementation manner, the second obtaining module is specifically configured to obtain, from first parameters corresponding to respective binary symbol models predefined by the decoder, respective first parameters corresponding to respective binary symbol models corresponding to the current frame to be decoded, and/or obtain, from respective predefined binary symbol models corresponding to the current frame to be decoded, respective first parameters predefined by the decoder.
In another possible implementation manner, the apparatus further includes:
any relevant information corresponding to each binary symbol model comprises at least one of the following relations:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be decoded respectively comprise at least one of the following relations:
The basic probability model parameters corresponding to the frames to be decoded are different;
the basic probability model parameters corresponding to at least two frames to be decoded are the same.
In another possible implementation manner, the storage space occupied by the related information of the difference value between any probability update speed parameter corresponding to any binary symbol model and the basic probability update speed parameter is 2 bits or 1 bit or 3 bits.
In another possible implementation, the information about the difference between at least the probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
In a seventh aspect, there is provided an electronic device, comprising:
one or more processors;
A memory;
one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the operations corresponding to the model updating method shown in the fifth aspect are performed.
In an eighth aspect, there is provided a computer readable storage medium storing at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by a processor to implement the model updating method as shown in the fifth aspect.
The technical scheme provided by the application has the beneficial effects that:
Compared with the prior art that when updating a model, probability update speed parameters corresponding to binary characters are stored in a memory, the method, the device and the computer readable storage medium acquire the related information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to a current frame to be encoded and a basic probability update speed parameter, update the respective binary symbol model through the acquired at least one related information corresponding to each binary symbol model, namely, only the related information of the difference value between the at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded and the basic probability update speed parameter is needed to be stored in the process of initializing the model, rather than directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference value between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
Compared with the prior art that when updating a model, probability update speed parameters corresponding to binary characters are stored in a memory, the method, the device and the computer readable storage medium acquire the related information of the difference between at least one probability update speed parameter corresponding to each binary symbol model corresponding to a current frame to be decoded and a basic probability update speed parameter, update the respective binary symbol model through the acquired at least one related information corresponding to each binary symbol model, namely, only the related information of the difference between the at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded and the basic probability update speed parameter is needed to be stored in the process of initializing the model, rather than directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 is a schematic flow chart of a model updating method according to an embodiment of the present application;
FIG. 2 is a flowchart of another model update method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a model updating device according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of another model updating apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
In existing video coding, such as AVS2, h.264/AVC, and HEVC, a Context-based adaptive binary arithmetic coding (CABAC) method is used to entropy encode a binary symbol string after binarizing a syntax element to further increase the compression rate. CABAC compresses again from a probability point of view, including binarization, building a binary symbol model, arithmetic coding, and updating information of the binary symbol model. Compared with the entropy coding method in the existing video coding (H.264/AVC), the CABAC module can improve the compression rate by 9-14% compared with the context-based adaptive side length coding (Context adaptive variable length coding), so the CABAC module is an important module for realizing high compression rate in video coding.
The basic idea of CABAC is to find a codeword by using a progressive method, and represent a number in the (0, 1) interval by using the codeword to represent the whole input character stream, instead of formulating a codeword for each character in the input character stream, thereby greatly saving the codeword written into the code stream and improving the compression rate. Starting from an initial interval (0, 1) determined by the first binary symbol, the current interval is recursively divided after each new binary symbol occurs, based on the probability of each binary symbol. And after the last binary symbol is processed, a final interval is obtained, and one number is selected in the final interval to be output. Further, the decoder obtains each binary symbol using the inverse process in the same way as the encoder.
Since the probability distribution of each binary symbol in a binary symbol string varies dynamically according to different coding parameters and the content of the input video source, a binary symbol model needs to be stored and maintained, and the information in the model includes: current least probable character (Least Probable Symbol, LPS) probability information or current most probable character (Most Probable Symbol, MPS) probability information, a lower limit of the current interval, a size of the current interval, and the current most probable character (Most Probable Symbol, MPS). For VVC, an encoded image may be divided into one or more frames, each frame containing 702 binary symbol models. Before encoding the current frame, the predefined 702 binary symbol models are firstly loaded into a memory, and each binary symbol model of the predefined binary symbol comprises: an initial value of LPS probability and an initial value of MPS. When the interval progresses, the probability of the current binary symbol is estimated through the information in the binary symbol model, and then the information in the binary symbol model is updated according to the current binary symbol information (including the probability information of the current binary symbol, MPS and the like).
In the CABAC method in which the AVS3 first-stage standard adopts a single model, the binary symbol model contains probability information of the maximum possible character (MPS) and probability update number-related information cycle, and the like. Wherein, the probability (P MPS) that MPS probability information (lg_p MPS) is MPS is converted to the value of logarithmic domain, and the calculation formula is lg_p MPS=1024x(-log2(PMPS)). bin is the binary symbol of the ith occurrence, and bin may be MPS or LPS. The updating process of the relevant information cycle of the probability updating times is that when bin is MPS, if the cycle is equal to 0, the cycle is set to be 1, and if the cycle is not equal to 0, the cycle is unchanged; when bin is LPS, if the cycle is less than or equal to 2, then the cycle is added with 1, otherwise the cycle is equal to 3.
The probability update speed parameter cwr is derived from the size of the cycle: if cycle is less than or equal to 1, cwr is 3; if cycle=2, cwr is 4; otherwise, i.e., cycle=3, cwr is 5.
Updating probability information in the binary symbol model according to probability information of the previous i-1 binary symbol after the ith binary symbol appears:
if the binary symbol bin is MPS, lg_p i=LG_Pi-1–Pi-1>>cwr–Pi-1 > > (cwr +2);
if the binary symbol bin is LPS, P i=Pi-1+LG_s,LG_s=log2(2cwr/2cwr -1) x1024.
In the joint video expert group (Joint Video Experts Team, JVET) VVC, a multi-model CABAC method is used, the idea of which is: for the same binary symbol, two binary symbol models are stored at the same time, and the probability update speeds in the two binary symbol models are different. The probability in the binary symbol model is updated by an exponential smoothing method, as shown in the following formula (1), the smaller the value of the probability is, the slower the model updating speed is, the smaller the interference of random noise is, and the estimated probability is more accurate; on the contrary, the larger the value is, the faster the model updating speed is, and the larger the interference of random noise is.
Pi=γbi+(1-γ)Pi-1 (1)
The method comprises the steps of representing probability P by an integer P, wherein the maximum value of the probability P is Y=2 k -1, wherein k bits are used for representing the integer P, then the formula (1) can be written as a formula (2), N is the right shift number in the formula (2), and the probability P corresponds to the probability update speed, wherein gamma=1/2 N, gamma is a parameter used for calculating updated P, N is a parameter used for calculating updated P, and the model update speed is slower as N is larger and gamma value is smaller, the interference caused by random noise is smaller, and the estimated probability is more accurate; conversely, the smaller N is, the larger the gamma value is, the faster the model updating speed is, and the larger the interference of random noise is. The probabilities in the binary symbol model are updated from the previous i-1 binary symbol after the current i-th binary symbol occurs:
Pi=Pi-1+((2k-Pi-1)>>N) (2)
Wherein, P i-1 in the formula (2) is a probability value after the last (i-1 th) binary symbol appears, and the probability value P i after the i-th appearance is equal to the right formula of the equal sign of the formula (2). > is a bitwise right shift operator, > N represents a bitwise right shift by N bits.
The multi-model CABAC method uses two probabilities P0 and P1 at the same time, wherein P0 uses a small right shift number a=4, P1 uses a large right shift number b=7 to control the update speeds of the two probabilities respectively, and the probability after the occurrence of the current i-th binary symbol is equal to the average value of P0 and P1, as shown in the following formula:
P0i=(Y>>a)+P0i-1–(P0i-1>>a)
P1i=(Y>>b)+P1i-1–(P0i-1>>b)
Pi=(P0i+P1i+1)>>1
The advantage of this is: let the optimal probability of LPS be 0.1 and the initial probability be set to 0.5. The probability of converging to the optimal probability by using a large right shift number is updated hundreds of times, so that the concept of updating the probability by using a small right shift number is introduced, namely, the characteristic of fast updating by using the small right shift number probability is utilized, and the LPS probability can be converged to the vicinity of the optimal probability rapidly. At the same time, the large right shift number is used to reduce the interference of random noise. The coding efficiency of entropy coding can be improved by combining the advantages of two right shift numbers
The multi-model CABAC method in VVC uses the same large right shift number b and small right shift number a for each binary symbol in the binary symbol string binarized for all syntax elements to be encoded. Because of the different content characteristics of the input video sources, the coding parameters are different, and there may be a great difference between probability distribution and variation of the binary symbols in the binary symbol strings of different syntax elements. For example, for a merge mode in inter prediction, the probability of being selected when the quantization parameter (Quantization Parameter, QP) value is larger than the probability of being selected when the QP value is smaller, so that the small right shift value of the probability update in the binary symbol model of the syntax element corresponding to the binary symbol of the merge mode in inter prediction can be set to a smaller value, for example, 3, when the QP value is larger, so that the LPS probability value can be updated quickly to the vicinity of the final probability; and is set to a larger value, e.g., 5, when QP is smaller, so that the LPS probability value is less disturbed by random noise, estimating a more accurate probability. However, the method in the conventional VVC cannot be implemented to set the corresponding optimal right shift number for each syntax element, and thus cannot achieve a larger compression rate.
There is also a way to set different right shift numbers for the binary symbol models of the respective binary symbols of the respective syntax element binary symbol strings. Each binary symbol model uses 4 bits to store a and b, wherein 1<a is less than or equal to b <9, and the value range of 4 bits of unsigned numbers is 0 to (2 4 -1). That is, each binary symbol model requires an additional 8 bits of memory. Each frame in VVC has 702 binary symbol models, and thus each frame requires an additional 8×702 bits of memory. And the more frames a coded image is divided, the more memory space is additionally occupied.
From the analysis of the technical problems, it can be found that the output code rate can be further reduced by setting different large right shift numbers and small right shift numbers for the binary symbol models of the binary symbols in the binary symbol strings of different syntax elements according to different coding parameters. The application provides a method for storing offset values, namely, only storing the difference between a large right shift number and a basic right shift number and the difference between a small right shift number and the basic right shift number on the premise of knowing the basic right shift number. For example, in the prior art, 4-bit storage a and 4-bit storage b are used for each binary symbol model, wherein 1<a.ltoreq.b <9, and the value range of 4-bit unsigned numbers is 0 to (2 4 -1), and 8 bits are required in total. If the present application is used, the basic right shift number 5 is known, the difference (b-5) between the large right shift number and the basic right shift number is stored using 2 bits for each binary symbol model, the value range of 0.ltoreq.b-5.ltoreq.3, the value range of 2-bit unsigned numbers is 0 to (2 2 -1), the difference (5-a) between the small right shift number and the basic right shift number is stored using 2 bits, and the total of 0.ltoreq.5-a.ltoreq.3 is required for 4 bits. For VVC, each frame has 702 binary symbol models, and the application can save the storage space of 4×702 bits for each frame; for AVS3, there are 389 binary symbol models per frame, which can be saved by 4 x 389 bits per frame using the present application. There is also a technique to set the value ranges of a and b to: a is more than or equal to 0 and b is more than or equal to 11, and 4 bits are used for storing a and b respectively. With the present application, if the number of basic right shifts is known to be 5, 3 bits are required to store (5-a) and (b-5), respectively, with 0.ltoreq.5-a.ltoreq.4, 0.ltoreq.b-5.ltoreq.6, and a 2-bit storage space per binary symbol model can be saved compared to the prior art. Moreover, the more frames a coded image is divided, the more memory space is saved. That is, compared with a method of directly storing a large right shift number and a small right shift number, the memory space can be greatly saved, and the coding efficiency using the multi-model CABAC method can be further improved.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides a model updating method, as shown in fig. 1, which comprises the following steps:
step S101, obtaining first parameters corresponding to each binary symbol model corresponding to a current frame to be coded.
The first parameters corresponding to the binary symbol model comprise: information about the difference between at least one probability update rate parameter and a base probability update rate parameter.
In one possible implementation manner of the embodiment of the present application, the information about the difference between the at least one probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
For example, the first parameter corresponding to the binary symbol model includes at least one of: an absolute value of a difference between the first probabilistic update rate parameter and the base probabilistic update rate parameter, and an absolute value of a difference between the second probabilistic update rate parameter and the base probabilistic update rate parameter.
Step S102, updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models.
Another possible implementation manner of the embodiment of the present application, after step S102, may further include: and encoding all syntax elements in the frame to be encoded based on the probability information of the updated binary symbol model.
Compared with the prior art that the probability update speed parameters corresponding to binary characters are stored in a memory when the model is updated, the embodiment of the application obtains the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded and the basic probability update speed parameter, and updates each binary symbol model through the obtained at least one relevant information corresponding to each binary symbol model, namely, when the model is initialized, only the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded and the basic probability update speed parameter is needed to be stored, instead of directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the relevant information of the difference value between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
In one possible implementation manner of the embodiment of the present application, the first parameter corresponding to the binary symbol model may further include: and the related information of the probability update times. In the embodiment of the application, the related information of the probability update times comprises the binary symbol model probability update times and a threshold value of the probability update times.
Another possible implementation manner of the embodiment of the present application, a manner of obtaining the threshold value of the probability update times includes: determining coding information of a current frame to be coded; and acquiring the threshold value of the probability updating times based on the coding information of the current frame to be coded.
In another possible implementation manner of the embodiment of the present application, step S101 may specifically include: and obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be coded, which is defined in advance.
Another possible implementation manner of the embodiment of the present application, step 101 may further include: step Sa (not shown in the figure), wherein,
Step Sa, storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner of the embodiment of the present application, step Sa may include: and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model into the memory corresponding to the binary symbol model.
For the embodiment of the application, the first parameters corresponding to all binary symbol models correspond to specific storage spaces in the memory. In the embodiment of the application, when initializing each binary symbol model, the first parameters corresponding to each binary symbol model are stored in the specific storage space corresponding to the memory.
In another possible implementation manner of the embodiment of the present application, step Sa may include: and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model corresponding to the current frame to be coded into the storage space occupied by each binary symbol model.
For the embodiment of the application, if at least one piece of relevant information corresponding to each binary symbol model is the same, and/or at least one piece of relevant information corresponding to each binary symbol model is not the same, the first parameters corresponding to each binary symbol model corresponding to the current frame to be coded can be stored in the storage space occupied by each binary symbol model when each binary symbol model is initialized.
Another possible implementation manner of the embodiment of the present application stores first parameters corresponding to each binary symbol model, including: and if at least one piece of relevant information corresponding to each binary symbol model is the same, storing the same at least one piece of relevant information as a frame level parameter to a frame level layer, wherein the at least one piece of relevant information is the relevant information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter.
For the embodiment of the present application, if the first parameter corresponding to any binary symbol model includes: and performing at least one of the following if the difference between the first probability update rate parameter and the base probability update rate parameter and the difference between the second probability update rate parameter and the base probability update rate parameter are:
if the relevant information of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model is the same, storing the relevant information of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter as a frame level parameter to a frame level layer;
and if the absolute values of the differences between the second probability updating speed parameters and the basic probability updating speed parameters corresponding to the binary symbol models are the same, storing the absolute values of the differences between the second probability updating speed parameters and the basic probability updating speed parameters as frame level parameters to a frame level layer.
For example, if the absolute values of the differences between the second probability update rate parameters and the basic probability update rate parameters corresponding to the binary symbol models are all 2,2 is stored as a frame level parameter to the frame level layer, and only one value needs to be stored.
In another possible implementation manner of the embodiment of the present application, step S102 may specifically include: step S1021 (not shown), step S1022 (not shown), and step S1023 (not shown), wherein,
Step S1021, acquiring a basic probability update speed parameter.
Step S1022, determining second parameters corresponding to the binary symbol models based on the first parameters corresponding to the binary symbol models and the obtained basic probability update speed parameters.
The second parameters corresponding to the binary symbol model comprise: at least one probability updates the speed parameter.
Step S1023, updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In another possible implementation manner of the embodiment of the present application, step S1021 specifically includes: determining coding information of a current frame to be coded; and acquiring a basic probability updating speed parameter based on the coding information of the current frame to be coded.
Another possible implementation manner of the embodiment of the present application, the coding information of the current frame to be coded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
Another possible implementation manner of the embodiment of the present application, the method further includes: and writing the basic probability updating speed parameter into the code stream.
In particular, the basic probability update speed parameter may be written into the bitstream before encoding the frame to be encoded.
In another possible implementation manner of the embodiment of the present application, step S101 may specifically include: at least one of step S1011 (not shown in the figure) and step S1012 (not shown in the figure), wherein,
Step S1011, obtaining the first parameters of each binary symbol model corresponding to the current frame to be encoded from the first parameters of each binary symbol model predefined by the encoder.
Step S1012, obtaining the respective predefined first parameters from each predefined binary symbol model corresponding to the current frame to be encoded.
Another possible implementation manner of the embodiment of the present application, the method further includes:
any relevant information corresponding to each binary symbol model comprises at least one of the following relations:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be coded respectively comprise at least one of the following relations:
the basic probability model parameters corresponding to the frames to be coded are different;
The parameters of the basic probability models corresponding to at least two frames to be coded are the same.
In another possible implementation manner of the embodiment of the present application, the second parameter corresponding to any binary symbol model includes two probability update speed parameters: a first probability update rate parameter for updating a first probability of the binary symbol model and a second probability update rate parameter for updating a second probability of the binary symbol model; the threshold for the number of probability updates in the first parameter of any binary symbol model includes: a first probability update times threshold and a second probability update times threshold, the second probability update times threshold not being less than the first probability update times threshold;
Wherein updating the corresponding binary symbol model based on the second parameters respectively corresponding to each binary symbol model comprises:
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the second parameters respectively corresponding to the binary symbol models and the threshold values of the respective corresponding probability updating times;
And updating the corresponding binary symbol model based on the updated first probability and/or the updated second probability respectively corresponding to the binary symbol models.
Another possible implementation manner of the embodiment of the present application updates at least one of a first probability of a corresponding binary symbol model and a second probability of the binary symbol model based on a second parameter corresponding to any binary symbol model and a threshold value of a corresponding probability update number, including:
Determining whether to update the first probability of any binary symbol model and/or the second probability of any binary symbol model based on the magnitude relation between the probability update times corresponding to any binary symbol model and the second probability update times threshold;
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the determination result and the second parameter corresponding to any binary symbol model.
The embodiment of the application also provides another decoding method, as shown in fig. 2, wherein,
Step 201, obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded.
The first parameters corresponding to the binary symbol model comprise: information about the difference between at least one probability update rate parameter and a base probability update rate parameter.
In one possible implementation manner of the embodiment of the present application, the information about the difference between the at least one probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
For example, the first parameter corresponding to the binary symbol model includes at least one of: an absolute value of a difference between the first probabilistic update rate parameter and the base probabilistic update rate parameter, and an absolute value of a difference between the second probabilistic update rate parameter and the base probabilistic update rate parameter.
In one possible implementation manner of the embodiment of the present application, the information about the difference between the at least one probability update speed parameter and the basic probability update speed parameter includes: the absolute value of the difference between the at least one probabilistic update rate parameter and the base probabilistic update rate parameter.
Step S202, updating the corresponding binary symbol model based on the first parameters respectively corresponding to the binary symbol models.
Another possible implementation manner of the embodiment of the present application, after step S202, may further include: and decoding all syntax elements in the frame to be decoded based on the probability information of the updated binary symbol model.
Compared with the prior art that the probability update speed parameters corresponding to binary characters are stored in a memory when the model is updated, the embodiment of the application obtains the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded and the basic probability update speed parameter, and updates each binary symbol model through the obtained at least one relevant information corresponding to each binary symbol model, namely, when the model is initialized, only the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded and the basic probability update speed parameter is needed to be stored, instead of directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the relevant information of the difference value between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
In one possible implementation manner of the embodiment of the present application, the first parameter corresponding to the binary symbol model may further include: and the related information of the probability update times. Wherein, the relevant information of the probability update times comprises: the number of probability updates and the threshold value of the number of probability updates.
Another possible implementation manner of the embodiment of the present application, a manner of obtaining a threshold value of a probability update number includes: determining coding information of a current frame to be decoded; and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
Another possible implementation manner of the embodiment of the present application, after step S201, may further include: step Sb (not shown in the figure), wherein,
And step Sb, storing the first parameters respectively corresponding to the binary symbol models.
For the embodiment of the application, the first parameters corresponding to the binary symbol models are stored in the memory.
In another possible implementation manner of the embodiment of the present application, the step Sb may specifically include: and when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded into the storage space occupied by each binary symbol model.
For the embodiment of the application, if at least one piece of relevant information corresponding to each binary symbol model is the same, and/or at least one piece of relevant information corresponding to each binary symbol model is not the same, the first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded can be stored in the storage space occupied by each binary symbol model when each binary symbol model is initialized.
Another possible implementation manner of the embodiment of the present application stores first parameters corresponding to each binary symbol model, including: and if at least one piece of relevant information corresponding to each binary symbol model is the same, storing the same at least one piece of relevant information as a frame level parameter to a frame level layer, wherein the at least one piece of relevant information is the relevant information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter.
For the embodiment of the present application, if the first parameter corresponding to any binary symbol model includes: and performing at least one of the following if the difference between the first probability update rate parameter and the base probability update rate parameter and the difference between the second probability update rate parameter and the base probability update rate parameter are:
if the relevant information of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model is the same, storing the relevant information of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter as a frame level parameter to a frame level layer;
and if the absolute values of the differences between the second probability updating speed parameters and the basic probability updating speed parameters corresponding to the binary symbol models are the same, storing the absolute values of the differences between the second probability updating speed parameters and the basic probability updating speed parameters as frame level parameters to a frame level layer.
In another possible implementation manner of the embodiment of the present application, step S202 may specifically include: step S2021 (not shown), step S2022 (not shown), and step S2023 (not shown), wherein,
Step S2021, acquiring a basic probability update speed parameter.
Step S2022, determining second parameters corresponding to the binary symbol models based on the first parameters corresponding to the binary symbol models stored in the memory and the obtained basic probability update speed parameters.
The second parameters corresponding to the binary symbol model comprise: at least one probability updates the speed parameter.
Step S2023, updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In another possible implementation manner of the embodiment of the present application, step S2021 may specifically include: at least one of step S2021a (not shown in the figure) and step S2021b (not shown in the figure), wherein,
Step S2021a acquires the basic probability update rate parameter from the code stream.
Step S2021b, based on the encoding information of the current frame to be decoded, acquires a basic probability update speed parameter.
Another possible implementation manner of the embodiment of the present application, the encoding information of the current frame to be decoded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
In another possible implementation manner of the embodiment of the present application, step S201 may specifically include: at least one of step S2011 (not shown) and step S2012 (not shown), wherein,
Step 2011, acquiring first parameters of each binary symbol model corresponding to the current frame to be decoded from first parameters of each binary symbol model predefined by the decoder.
Step 2012, respectively obtaining respective predefined first parameters from each predefined binary symbol model corresponding to the current frame to be decoded.
In another possible implementation manner of the embodiment of the present application, any relevant information corresponding to each binary symbol model includes at least one of the following relationships:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be decoded respectively comprise at least one of the following relations:
The basic probability model parameters corresponding to the frames to be decoded are different;
the basic probability model parameters corresponding to at least two frames to be decoded are the same.
The above description of the method flow describes a model update method, which is described by several specific embodiments below in combination with encoding by an encoder (e.g., entropy encoding) and in combination with decoding by a decoder (e.g., entropy decoding), as follows:
The embodiment of the application provides a method for entropy coding in an encoder, wherein each coded image can be divided into one frame or at least two frames, and the method is not limited herein. When an encoded image is divided into a frame, the method for encoding the image is described in detail in the following embodiments; if a coded image is divided into at least two frames, each frame of image is coded when the coded image is coded, wherein the coding mode for any frame of image is described in the following embodiment, wherein,
Step S301 (not shown in the figure): binary symbol model parameters of binary symbols of binary symbol strings corresponding to all grammar elements in a frame to be encoded are obtained.
For embodiments of the present application, any binary symbol model parameter may include: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
For the embodiment of the present application, the value of the large right displacement number is larger than the value of the small right displacement number.
For the embodiment of the application, the absolute value of the difference between any probability model speed parameter and the basic probability update speed parameter can occupy 1 bit, 2 bits or 3 bits of storage space. In the embodiment of the application, the absolute value of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter can occupy 1 bit, 2 bits or 3 bits of the storage space; the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter may occupy a memory space of 1 bit, 2 bits or 3 bits.
Step S302 (not shown in the figure): before the current frame is encoded and when the binary symbol model of each binary symbol is initialized, the parameters of each binary symbol model are stored into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may be different according to the type of the current frame to be encoded, including: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the absolute values of (Base-a) and (b-Base) are stored in a frame level layer as parameters of a frame level, and only one value is needed to be stored respectively, and the values can be stored in memories occupied by respective models during initialization.
For the embodiment of the application, when the values of (Base-a) are not the same for each binary symbol and the values of (b-Base) are not the same, the values are stored in the memory occupied by the respective models during initialization.
Step S303 (not shown in the figure): and determining the coding information of the current frame to be coded, and acquiring a corresponding basic probability updating speed parameter (basic right displacement number) according to the coding information of the current frame to be coded.
For the embodiments of the present application, the frames to be encoded may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the frame type of the frame to be encoded, wherein the frame type of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, the I frame has a Base1 bit right shift, the B frame has a Base2 bit right shift, and the P frame has a Base3 bit right shift. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in any two ways. The embodiment of the application is not limited.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the quantization parameter of the frame to be encoded, wherein the quantization parameter of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, QP < 38, the basic right shift number may be Base4, QP > 38, or qp=38, and the basic right shift number may be Base5, where Base4 and Base5 may be the same or different.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the image resolution of the frame to be encoded, wherein the image resolution of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, for a resolution of 1280×720, the basic right shift number is Base6; for a resolution of 1920×1080, the basic right shift number is Base7; for a resolution of 4k, the basic right shift number is Base8. Wherein, base6, base7 and Base8 may be the same, or may be different, or may be any two of the same.
For the embodiment of the application, the basic probability update speed parameter (basic right displacement number) is determined based on any combination in the coding information of the frame to be coded, wherein the basic probability update speed parameter (basic right displacement number) can be the same or different when any combination in the coding information of the frame to be coded is different.
For example, the Base right shift count at I frame QP <38 is Base9, the Base right shift count at I frame QP > 38 or qp=38 is Base10, the Base right shift count at B frame QP <38 is Base11, the Base right shift count at B frame QP > 38 or qp=38 is Base12, the Base right shift count at P frame QP <38 is Base13, and the Base right shift count at B frame QP > 38 or qp=38 is Base14.
For example, the basic right shift number of an I frame image with POC 0 is Base15, the basic right shift number of an I frame with POC greater than 0 is Base16, the basic right shift number of a B frame is Base17, and the basic right shift number of a P frame is Base18.
For example, for an I-frame image, the basic right shift number when the encoding is configured as a full I-frame (al Intra, AI) is Base19, and the basic right shift number when the encoding is configured as a Low Delay (LD) and Random Access (RA) is Base20; the basic right shift number of B frames in all encoding configurations is Base21 and the basic right shift number of P frames in all encoding configurations is Base22.
For the embodiment of the present application, step S303 may be performed before step S301, may be performed before step S302, may be performed after step S301, may be performed after step S302, or may be performed simultaneously with step S301 and/or step S302, and in the embodiment of the present application, there is no strict order of execution between step S303 and step S301 and step S302.
For the embodiment of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, and the encoder writes its value into the code stream before encoding the frame; or the basic right shift number is a consistent value predetermined by the encoder and decoder without writing the code stream. In the embodiment of the application, the basic right shift number can be written into the code stream before the frame to be encoded is encoded.
Step S304 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S302 and the basic right shift number obtained in step S303, calculating to obtain a large right shift number b and a small right shift number a, and updating the information in the model, namely updating the LPS probability P i in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol, wherein the maximum value is y= k:
P0i=(Y>>a)+P0i-1–(P0i-1>>a)
P1i=(Y>>b)+P1i-1–(P0i-1>>b)
Pi=(P0i+P1i+1)>>1
for the embodiment of the application, after all frames in the current image are encoded in the above manner, that is, all syntax elements of all frames in the current image are encoded, a code stream of the current image is generated and output.
The embodiment of the application also provides another method for entropy coding in the encoder, wherein each coded image can be divided into one frame or at least two frames, and the method is not limited herein. When an encoded image is divided into a frame, the method for encoding the image is described in detail in the following embodiments; if a coded image is divided into at least two frames, each frame of image needs to be coded when the coded image is coded, wherein the coding mode for any frame of image is described in the following embodiments, wherein,
Step S401 (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and/or the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the basic right shift is a few base.
For the embodiment of the present application, the predefined model parameters defined in advance may be different or the same according to the coding parameters. The embodiment of the application is not limited.
Step S402 (not shown in the figure): when the binary symbol model of each binary symbol is initialized before the current frame is encoded, the predefined model parameters obtained in the step S401 are read in and are respectively and correspondingly stored in the memory occupied by each model.
Step S403 (not shown in the figure): and determining the coding information of the current frame to be coded, and determining basic probability model parameters (basic right displacement numbers) according to the coding information of the current frame to be coded.
Specifically, the type frame of the current frame to be encoded may include: intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
For embodiments of the present application, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the present application, step S403 may be performed before step S401, may be performed before step S402, may be performed after step S401, may be performed after step S402, or may be performed simultaneously with step S401 and/or step S402, and in the embodiment of the present application, there is no strict order of execution between step S403 and step S401 and step S402.
Step S404 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S402 and the basic probability model parameters (basic right shift number) obtained in step S403, respectively calculating the first probability update rate parameter and/or the second probability update rate parameter (large right shift number b and/or small right shift number a) corresponding to each binary symbol model, respectively, and updating the information in the model, namely updating the LPS (least possible character) probability P i in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol, wherein the maximum value is y= k:
P0i=(Y>>a)+P0i-1–(P0i-1>>a)
P1i=(Y>>b)+P1i-1–(P0i-1>>b)
Pi=(P0i+P1i+1)>>1
for the embodiment of the application, after all frames in the current image are encoded in the above manner, that is, all syntax elements of all frames in the current image are encoded, a code stream of the current image is generated and output.
The above embodiment describes the manner of encoding by the encoder, and the following embodiment describes the manner of decoding by the decoder, and each decoded image may be divided into one frame or at least two frames, which is not limited herein. When a decoded image is divided into a frame, the method for decoding the image is described in detail in the following embodiments; if a decoded image is divided into at least two frames, each frame of image needs to be decoded when decoding the decoded image, wherein the decoding manner for any frame of image is described in the following embodiments, wherein,
Step S601 (not shown in the figure): and acquiring binary symbol model parameters of binary symbols of binary symbol strings corresponding to each syntax element corresponding to the current frame to be decoded.
For embodiments of the present application, any binary symbol model parameter may include: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
Step S602 (not shown in the figure): and when the binary symbol model of each binary symbol is initialized before the current frame is decoded, respectively storing the parameters of each binary symbol model into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may include, depending on the type of frame currently to be decoded: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the values of (Base-a) and (b-Base) are stored as parameters at the frame level, and only one value need be stored each; it is of course also possible to store its value in the memory occupied by the respective model at initialization.
Step S603 (not shown in the figure): and determining the coding information of the current frame to be decoded, and determining basic probability model parameters (basic right shift numbers) according to the coding information of the current frame to be decoded.
Specifically, the type of the current frame to be decoded is obtained from the input code stream. The frames may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic right shift number of the I frame is Base1, the basic right shift number of the B frame is Base2, and the basic right shift number of the P frame is Base3. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in pairs. The embodiment of the application is not limited.
For the embodiment of the application, the value of the basic right shift number can be a consistent value preset by an encoder and a decoder, and can also be read from a code stream by the decoder. The basic right shift number in the embodiment of the application is a consistent value predefined by the encoder and decoder, and does not need to be read from the code stream.
Step S604 (not shown): according to the parameters in the binary symbol model of each binary symbol stored in step S602 and the basic right shift number obtained in step S603, a first probability update rate parameter and/or a second probability update rate parameter (a large right shift number b and/or a small right shift number a) corresponding to each binary symbol model are calculated and obtained, and the information in the model, that is, the probability P i of the LPS (minimum possible character) in the probability model of the binary symbol is updated after the occurrence of the ith binary symbol, the maximum value is y=2 k:
P0i=(Y>>a)+P0i-1–(P0i-1>>a)
P1i=(Y>>b)+P1i-1–(P0i-1>>b)
Pi=(P0i+P1i+1)>>1
For the embodiment of the application, after all frames are decoded in the above manner, that is, all syntax elements of all frames in the current image are decoded, the reconstructed image is output.
The embodiment of the application also provides a method for entropy coding in a decoder, wherein each decoded image can be divided into one frame or at least two frames, and the method is not limited herein. When a decoded image is divided into a frame, the method for decoding the image is described in detail in the following embodiments; if a decoded image is divided into at least two frames, each frame of image needs to be decoded when decoding the decoded image, wherein the decoding manner for any frame of image is described in the following embodiments, wherein,
Step S701 (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and/or the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
For the embodiment of the present application, parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance may be different or the same according to different encoding information of a frame to be decoded. The embodiment of the application is not limited.
Step S702 (not shown in the figure): before decoding the current frame and initializing the binary symbol model of each binary symbol, the predefined model parameters obtained in step S701 are read in and stored in the memory occupied by each model.
Step S703 (not shown in the figure): and determining the coding information of the current frame to be decoded, and determining a first probability updating speed parameter and/or a second probability updating speed parameter (a large right shift number b and/or a small right shift number a) corresponding to each binary symbol model according to the coding information of the current frame to be decoded.
Specifically, the types of the current frame to be decoded may include: intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the present application, step S703 may be performed before step S701, may be performed before step S702, may be performed after step S701, may be performed after step S702, or may be performed simultaneously with step S701 and/or step S702, and in the embodiment of the present application, there is no strict order of execution between step S703 and step S701 and step S702.
Step S704 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S702 and the basic right shift number obtained in step S703, calculating to obtain a large right shift number b and a small right shift number a, and updating the information in the model, that is, updating the LPS (least probable character) probability P i in the probability model of the binary symbol after the occurrence of the ith binary symbol, with a maximum value of y= k:
P0i=(Y>>a)+P0i-1–(P0i-1>>a)
P1i=(Y>>b)+P1i-1–(P0i-1>>b)
Pi=(P0i+P1i+1)>>1
For the embodiment of the application, after all frames are decoded in the above manner, that is, all syntax elements of all frames in the current image are decoded, the reconstructed image is output.
The embodiment of the application provides a method for entropy coding in an encoder, wherein each coded image can be divided into one frame or at least two frames, and the method is not limited herein. When an encoded image is divided into a frame, the method for encoding the image is described in detail in the following embodiments; if a coded image is divided into at least two frames, each frame of image is coded when the coded image is coded, wherein the coding mode for any frame of image is described in the following embodiment, wherein,
Step S801 (not shown in the figure): binary symbol model parameters of binary symbols of binary symbol strings corresponding to all grammar elements in a frame to be encoded are obtained.
For embodiments of the present application, any binary symbol model parameter may include: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter, and an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
For the embodiment of the present application, the value of the large right displacement number is larger than the value of the small right displacement number.
For the embodiment of the application, the absolute value of the difference between any probability model speed parameter and the basic probability update speed parameter can occupy 1 bit, 2 bits or 3 bits of storage space. In the embodiment of the application, the absolute value of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter can occupy 1 bit, 2 bits or 3 bits of the storage space; the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter may occupy a memory space of 1 bit, 2 bits or 3 bits.
Step S802 (not shown in the figure): before the current frame is encoded and when the binary symbol model of each binary symbol is initialized, the parameters of each binary symbol model are stored into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may be different according to the type of the current frame to be encoded, including: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the absolute values of (Base-a) and (b-Base) are stored in a frame level layer as parameters of a frame level, and only one value is needed to be stored respectively, and the values can be stored in memories occupied by respective models during initialization.
For the embodiment of the application, when the values of (Base-a) are not the same for each binary symbol and the values of (b-Base) are not the same, the values are stored in the memory occupied by the respective models during initialization.
Step S803 (not shown in the figure): and determining the coding information of the current frame to be coded, and acquiring a corresponding basic probability updating speed parameter (basic right displacement number) according to the coding information of the current frame to be coded.
For the embodiments of the present application, the frames to be encoded may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the frame type of the frame to be encoded, wherein the frame type of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, the I frame has a Base1 bit right shift, the B frame has a Base2 bit right shift, and the P frame has a Base3 bit right shift. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in any two ways. The embodiment of the application is not limited. For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the quantization parameter of the frame to be encoded, wherein the quantization parameter of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, QP < 38, the basic right shift number may be Base4, QP > 38, or qp=38, and the basic right shift number may be Base5, where Base4 and Base5 may be the same or different.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the image resolution of the frame to be encoded, wherein the image resolution of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, for a resolution of 1280×720, the basic right shift number is Base6; for a resolution of 1920×1080, the basic right shift number is Base7; for a resolution of 4k, the basic right shift number is Base8. Wherein, base6, base7 and Base8 may be the same, or may be different, or may be any two of the same.
For the embodiment of the application, the basic probability update speed parameter (basic right displacement number) is determined based on any combination in the coding information of the frame to be coded, wherein the basic probability update speed parameter (basic right displacement number) can be the same or different when any combination in the coding information of the frame to be coded is different.
For example, the Base right shift count at I frame QP <38 is Base9, the Base right shift count at I frame QP > 38 or qp=38 is Base10, the Base right shift count at B frame QP <38 is Base11, the Base right shift count at B frame QP > 38 or qp=38 is Base12, the Base right shift count at P frame QP <38 is Base13, and the Base right shift count at B frame QP > 38 or qp=38 is Base14.
For example, the basic right shift number of an I frame image with POC 0 is Base15, and the basic right shift number of an I frame with POC greater than 0 is Base16; the basic right shift number of B frames is Base17 and the basic right shift number of P frames is Base18.
For example, for an I-frame image, the basic right shift number when the encoding is configured as a full I-frame (al Intra, AI) is Base19, and the basic right shift number when the encoding is configured as a Low Delay (LD) and Random Access (RA) is Base20. The basic right shift number of B frames in all encoding configurations is Base21 and the basic right shift number of P frames in all encoding configurations is Base22.
For the embodiment of the present application, step S803 may be performed before step S801, may be performed before step S802, may be performed after step S801, may be performed after step S802, or may be performed simultaneously with step S801 and/or step S802, and in the embodiment of the present application, there is no strict order of execution between step S803 and step S801 and step S802.
For the embodiment of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, and the encoder writes its value into the code stream before encoding the frame; or the basic right shift number is a consistent value predetermined by the encoder and decoder without writing the code stream. In the embodiment of the application, the basic right shift number can be written into the code stream before the frame to be encoded is encoded.
Step S804 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S802 and the basic right shift number obtained in step S803, the large right shift number b and the small right shift number a are calculated and obtained, and the information in the model is updated, that is, the probability P i in the binary symbol model of the binary symbol and the related information cycle of the number of model updates after the occurrence of the ith binary symbol bin are updated. The small right shift number a is used to calculate the updated probability P0 and the large right shift number b is used to calculate the updated probability P1.
Specifically, one possible implementation is:
when the probability update times related information cycle is smaller than 32 (the present embodiment is set to 32, other values are also possible), only P0 is updated, and the value of P1 is equal to the updated value of P0. The update rate cwr of P0 is derived from cycle: when the cycle is less than or equal to 1, cwr is 3; cwr is 4 when cycle is equal to 2; cwr is 5 when cycle is greater than 2 and less than 32. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times related information cycle is equal to 32, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the relevant information cycle of the model updating times comprises the following steps: if the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged; if the binary symbol bin is LPS, if the cycle is less than 32, then the cycle is added with 1; otherwise, the cycle is unchanged.
Another possible implementation is: when the update times related information cycle is smaller than 32, only the value of P0 and the value of P1 are updated to be equal to the value of P0 after updating. The update rate cwr of P0 is derived from cycle: when the cycle is less than or equal to 1, cwr is 3; cwr is 4 when cycle is equal to 2; cwr is a when cycle is greater than 2 and less than 32. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times related information cycle is equal to 32, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the relevant information cycle of the model updating times comprises the following steps: if the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged; if the binary symbol bin is LPS, if the cycle is less than 32, then the cycle is added with 1; otherwise, the cycle is unchanged.
For the embodiment of the application, after all frames in the current image are encoded in the above manner, that is, all syntax elements of all frames in the current image are encoded, a code stream of the current image is generated and output.
Step 801 and step 802 in this embodiment may be replaced by:
Step S801 (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter and/or an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the basic right shift is a few base.
For the embodiment of the present application, the predefined model parameters defined in advance may be different or the same according to the coding parameters. The embodiment of the application is not limited.
Step S802 (not shown in the figure): when the binary symbol model of each binary symbol is initialized before the current frame is encoded, the predefined model parameters obtained in step S801 are read in and respectively stored in the memory occupied by each model.
The above embodiment describes the manner of encoding by the encoder, and the following embodiment describes the manner of decoding by the decoder, and each decoded image may be divided into one frame or at least two frames, which is not limited herein. When a decoded image is divided into a frame, the method for decoding the image is described in detail in the following embodiments; if a decoded image is divided into at least two frames, each frame of image needs to be decoded when decoding the decoded image, wherein the decoding manner for any frame of image is described in the following embodiments, wherein,
Step S901 (not shown in the figure): and acquiring binary symbol model parameters of binary symbols of binary symbol strings corresponding to each syntax element corresponding to the current frame to be decoded.
For embodiments of the present application, any binary symbol model parameter may include: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter, and an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
Step S902 (not shown in the figure): and when the binary symbol model of each binary symbol is initialized before the current frame is decoded, respectively storing the parameters of each binary symbol model into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may include, depending on the type of frame currently to be decoded: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the values of (Base-a) and (b-Base) are stored as parameters at the frame level, and only one value need be stored each; it is of course also possible to store its value in the memory occupied by the respective model at initialization.
Step S903 (not shown in the figure): and determining the coding information of the current frame to be decoded, and determining basic probability model parameters (basic right shift numbers) according to the coding information of the current frame to be decoded.
Specifically, the type of the current frame to be decoded is obtained from the input code stream. The frames may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic right shift number of the I frame is Base1, the basic right shift number of the B frame is Base2, and the basic right shift number of the P frame is Base3. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in pairs. The embodiment of the application is not limited.
For the embodiment of the application, the value of the basic right shift number can be a consistent value preset by an encoder and a decoder, and can also be read from a code stream by the decoder. The basic right shift number in the embodiment of the application is a consistent value predefined by the encoder and decoder, and does not need to be read from the code stream.
Step S904 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S902 and the basic right shift number obtained in step S903, a large right shift number b and a small right shift number a are calculated and obtained, and the information in the model is updated, that is, the probability P i in the binary symbol model of the binary symbol and the related information cycle of the number of model updates are updated after the occurrence of the ith binary symbol bin. The small right shift number a is used to calculate the updated probability P0 and the large right shift number b is used to calculate the updated probability P1. Specifically, one possible implementation is:
When the update times related information cycle is smaller than 32, only the value of P0 and the value of P1 are updated to be equal to the value of P0 after updating. The update rate cwr of P0 is derived from cycle: when the cycle is less than or equal to 1, cwr is 3; cwr is 4 when cycle is equal to 2; cwr is 5 when cycle is greater than 2 and less than 32. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times related information cycle is equal to 32, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the relevant information cycle of the model updating times comprises the following steps:
If the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged;
If the binary symbol bin is LPS, if the cycle is less than 32, then the cycle is added with 1; otherwise, the cycle is unchanged.
Another possible implementation is: when the update times related information cycle is smaller than 32, only the value of P0 and the value of P1 are updated to be equal to the value of P0 after updating. The update rate cwr of P0 is derived from cycle: when the cycle is less than or equal to 1, cwr is 3; cwr is 4 when cycle is equal to 2; cwr is a when cycle is greater than 2 and less than 32. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times related information cycle is equal to 32, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the relevant information cycle of the model updating times comprises the following steps: if the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged; if the binary symbol bin is LPS, if the cycle is less than 32, then the cycle is added with 1; otherwise, the cycle is unchanged.
Step 901 and step 902 in this embodiment may be replaced by:
Step S901 (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and/or the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base.
For the embodiment of the present application, parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance may be different or the same according to different encoding information of a frame to be decoded. The embodiment of the application is not limited.
Step S902 (not shown in the figure): before decoding the current frame and initializing the binary symbol model of each binary symbol, the predefined model parameters obtained in step S901 are read in and stored in the memory occupied by each model.
For the embodiment of the application, after all frames are decoded in the above manner, that is, all syntax elements of all frames in the current image are decoded, the reconstructed image is output.
The embodiment of the application provides a method for entropy coding in an encoder, wherein each coded image can be divided into one frame or at least two frames, and the method is not limited herein. When an encoded image is divided into a frame, the method for encoding the image is described in detail in the following embodiments; if a coded image is divided into at least two frames, each frame of image is coded when the coded image is coded, wherein the coding mode for any frame of image is described in the following embodiment, wherein,
Step S1001 (not shown in the figure): binary symbol model parameters of binary symbols of binary symbol strings corresponding to all grammar elements in a frame to be encoded are obtained.
For embodiments of the present application, any binary symbol model parameter may include: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter, and an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base. The information about the number of probability updates may include: probability number of updates and number of updates threshold.
For the embodiment of the present application, the value of the large right displacement number is larger than the value of the small right displacement number.
For the embodiment of the application, the absolute value of the difference between any probability model speed parameter and the basic probability update speed parameter can occupy 1 bit, 2 bits or 3 bits of storage space. In the embodiment of the application, the absolute value of the difference value between the first probability updating speed parameter and the basic probability updating speed parameter can occupy 1 bit, 2 bits or 3 bits of the storage space; the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter may occupy a memory space of 1 bit, 2 bits or 3 bits.
For embodiments of the present application, the probability update times threshold for any binary symbol model may include: the first probability update times threshold and the second probability update times threshold, wherein the second probability update times threshold is larger than the first probability update times threshold, or is equal to the first probability update times threshold, but is not smaller than the first probability update times threshold.
In one possible implementation manner of the embodiment of the present application, the probability update frequency threshold of any binary symbol model may be determined according to the current information to be encoded, and for the embodiment of the present application, the probability update frequency threshold is determined according to the type of the frame to be encoded, the first probability update frequency threshold of each binary symbol model in the same frame is the same, the second probability update frequency threshold is the same, and the first probability update frequency threshold and the second probability update frequency threshold are stored at the frame level. The frames to be encoded may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames). Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the frame types of the frames to be encoded are different, the first probability updating times threshold value can be the same or different, and the second probability updating times threshold value can be the same or different.
For example, the first probability update times threshold of the I frame is threshold1, the second probability update times threshold is threshold2, the first probability update times threshold of the B frame is threshold3, the second probability update times threshold is threshold4, the first probability update times threshold of the P frame is threshold5, and the second probability update times threshold is threshold6. the three values of threshold1, threshold3 and threshold5 may be identical, may be different, or may be the same for any two. The three values of Threshold2, threshold4 and Threshold6 may be identical, may be different, or may be the same for any two. The embodiment of the application is not limited.
Another possible implementation manner is that the probability update times threshold values of the binary symbol models in the same frame are different from each other, or the probability update times threshold values of the binary symbol models in the same frame are the same, or the probability update times threshold values of the binary symbol models in the same frame are partially the same. The embodiment of the application is not limited.
For the embodiment of the application, the storage space which can be occupied by the probability update times is determined by a second probability update times threshold, wherein the second probability update times threshold can be 4, and the probability update times occupy 2 bits of the storage space; the second probability update times threshold may be8, and the probability update times occupy 3 bits of the storage space; the second probability update times threshold may be 16, and the probability update times occupy 4 bits of the storage space; the second probability update times threshold may be 32, and the probability update times occupy 5 bits of the memory space.
Step S1002 (not shown in the figure): before the current frame is encoded and when the binary symbol model of each binary symbol is initialized, the parameters of each binary symbol model are stored into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may be different according to the type of the current frame to be encoded, including: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the absolute values of (Base-a) and (b-Base) are stored in the frame level layer as parameters of the frame level, and only one value is needed to be stored respectively, and the values can be stored in the memory occupied by the respective model during initialization.
For the embodiment of the application, when the values of (Base-a) are not the same for each binary symbol and the values of (b-Base) are not the same, the values are stored in the memory occupied by the respective models during initialization.
For the embodiment of the application, for each binary symbol in the same frame, when the first probability updating frequency thresholds are different or partially the same, the first probability updating frequency thresholds are stored in the occupied memories of the respective models. And when the second probability updating times threshold value is different from or partially the same as the second probability updating times threshold value, storing the second probability updating times threshold value in the occupied memory of each model.
For the embodiment of the application, when the first probability updating time threshold and/or the second probability updating time threshold are the same for each binary symbol in the same frame, the first probability updating time threshold and/or the second probability updating time threshold are stored in a frame level layer as frame level parameters, and only one value is needed to be stored respectively, and the value can be stored in the occupied memory of each model in the initialization process.
Step S1003 (not shown in the figure): and determining the coding information of the current frame to be coded, and acquiring a corresponding basic probability updating speed parameter (basic right displacement number) according to the coding information of the current frame to be coded.
For the embodiments of the present application, the frames to be encoded may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the frame type of the frame to be encoded, wherein the frame type of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, the I frame has a Base1 bit right shift, the B frame has a Base2 bit right shift, and the P frame has a Base3 bit right shift. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in any two ways. The embodiment of the application is not limited. For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the quantization parameter of the frame to be encoded, wherein the quantization parameter of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, QP < 38, the basic right shift number may be Base4, QP > 38, or qp=38, and the basic right shift number may be Base5, where Base4 and Base5 may be the same or different.
For the embodiment of the application, the basic probability update speed parameter (basic right shift number) is determined based on the image resolution of the frame to be encoded, wherein the image resolution of the frame to be encoded is different, and the basic probability update speed parameter (basic right shift number) can be the same or different.
For example, for a resolution of 1280×720, the basic right shift number is Base6; for a resolution of 1920×1080, the basic right shift number is Base7; for a resolution of 4k, the basic right shift number is Base8. Wherein, base6, base7 and Base8 may be the same, or may be different, or may be any two of the same.
For the embodiment of the application, the basic probability update speed parameter (basic right displacement number) is determined based on any combination in the coding information of the frame to be coded, wherein the basic probability update speed parameter (basic right displacement number) can be the same or different when any combination in the coding information of the frame to be coded is different.
For example, the Base right shift count at I frame QP <38 is Base9, the Base right shift count at I frame QP > 38 or qp=38 is Base10, the Base right shift count at B frame QP <38 is Base11, the Base right shift count at B frame QP > 38 or qp=38 is Base12, the Base right shift count at P frame QP <38 is Base13, and the Base right shift count at B frame QP > 38 or qp=38 is Base14.
For example, the basic right shift number of an I frame image with POC 0 is Base15, and the basic right shift number of an I frame with POC greater than 0 is Base16; the basic right shift number of B frames is Base17 and the basic right shift number of P frames is Base18.
For example, for an I-frame image, the basic right shift number when the encoding is configured as a full I-frame (al Intra, AI) is Base19, and the basic right shift number when the encoding is configured as a Low Delay (LD) and Random Access (RA) is Base20. The basic right shift number of B frames in all encoding configurations is Base21 and the basic right shift number of P frames in all encoding configurations is Base22.
For the embodiment of the present application, step S1003 may be performed before step S1001, may be performed before step S1002, may be performed after step S1001, may be performed after step S1002, or may be performed simultaneously with step S1001 and/or step S1002, and in the embodiment of the present application, there is no strict order of execution between step S1003 and step S1001 and step S1002.
For the embodiment of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, and the encoder writes its value into the code stream before encoding the frame; or the basic right shift number is a consistent value predetermined by the encoder and decoder without writing the code stream. In the embodiment of the application, the basic right shift number can be written into the code stream before the frame to be encoded is encoded.
Step S1004 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S1002 and the basic right shift number obtained in step S1003, a large right shift number b and a small right shift number a are calculated and obtained, and the information in the model is updated, that is, the probability P i and the number of model updates cycle in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol bin. The small right shift number a is used to calculate the updated probability P0 and the large right shift number b is used to calculate the updated probability P1.
Specifically, one possible implementation manner in the embodiment of the present application is:
When the probability update times cycle is smaller than the second probability update times threshold, only the value of P0 and P1 is updated to be equal to the updated value of P0. The update rate cwr of P0 is derived from cycle: cwr is a-1 when the cycle is less than the first probability update times threshold; and cwr is a when the cycle is greater than or equal to the first probability update times threshold and less than the second probability update times threshold. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times cycle is equal to the second probability update times threshold, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the model updating frequency cycle comprises the following steps: if the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged; if the binary symbol bin is LPS, if the cycle is smaller than the second probability updating frequency threshold, adding 1 to the cycle; otherwise, the cycle is unchanged.
For the embodiment of the application, after all frames in the current image are encoded in the above manner, that is, all syntax elements of all frames in the current image are encoded, a code stream of the current image is generated and output.
Step 1001 and step 1002 in the embodiment of the present application may be replaced by: step S1001a, and step S1002a, wherein,
Step S1001a (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter and/or an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the basic right shift is a few base. The information about the number of probability updates may include: probability number of updates and number of updates threshold.
For the embodiment of the present application, the predefined model parameters defined in advance may be different or the same according to the coding parameters. The embodiment of the application is not limited.
Step S1002a (not shown): when the binary symbol model of each binary symbol is initialized before the current frame is encoded, the predefined model parameters obtained in step S1001a are read in and respectively stored in the memory occupied by each model.
The above embodiment describes the manner of encoding by the encoder, and the following embodiment describes the manner of decoding by the decoder, and each decoded image may be divided into one frame or at least two frames, which is not limited herein. When a decoded image is divided into a frame, the method for decoding the image is described in detail in the following embodiments; if a decoded image is divided into at least two frames, each frame of image needs to be decoded when decoding the decoded image, wherein the decoding manner for any frame of image is described in the following embodiments, wherein,
Step S1101 (not shown in the figure): and acquiring binary symbol model parameters of binary symbols of binary symbol strings corresponding to each syntax element corresponding to the current frame to be decoded.
For embodiments of the present application, any binary symbol model parameter may include: related information of the number of probability updates, an absolute value of a difference between the first probability update rate parameter and the basic probability update rate parameter, and an absolute value of a difference between the second probability update rate parameter and the basic probability update rate parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base. The information about the number of probability updates may include: probability number of updates and number of updates threshold.
For embodiments of the present application, the probability update times threshold for any binary symbol model may include: the first probability update times threshold and the second probability update times threshold, wherein the second probability update times threshold is larger than the first probability update times threshold, or is equal to the first probability update times threshold, but is not smaller than the first probability update times threshold.
One possible implementation manner is that a probability update time threshold of any binary symbol model may be determined according to coding information of a current frame to be decoded, and for the embodiment of the present application, the probability update time threshold is determined according to a type of the frame to be decoded, first probability update time thresholds of each binary symbol model in the same frame are the same, second probability update time thresholds are the same, and the first probability update time threshold and the second probability update time threshold are stored in a frame level layer. The frames to be decoded may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames). Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the frame types of the frames to be decoded are different, the first probability updating times threshold value can be the same or different, and the second probability updating times threshold value can be the same or different.
For example, the first probability update times threshold of the I frame is threshold1, the second probability update times threshold is threshold2, the first probability update times threshold of the B frame is threshold3, the second probability update times threshold is threshold4, the first probability update times threshold of the P frame is threshold5, and the second probability update times threshold is threshold6. the three values of threshold1, threshold3 and threshold5 may be identical, may be different, or may be the same for any two. The three values of Threshold2, threshold4 and Threshold6 may be identical, may be different, or may be the same for any two. The embodiment of the application is not limited.
Another possible implementation manner is that the probability update times threshold values of the binary symbol models in the same frame are different from each other, or the probability update times threshold values of the binary symbol models in the same frame are the same, or the probability update times threshold values of the binary symbol models in the same frame are partially the same. The embodiment of the application is not limited.
Step S1102 (not shown in the figure): and when the binary symbol model of each binary symbol is initialized before the current frame is decoded, respectively storing the parameters of each binary symbol model into the memory occupied by the model.
For the embodiment of the application, the value of (Base-a) may be the same for each binary symbol, may be different, or may be partially the same. The values of (b-Base) may be the same, may be different from each other, or may be partially the same. Wherein Base may include, depending on the type of frame currently to be decoded: base1, or Base2, or Base3.
For the embodiment of the application, when the values of (Base-a) are the same for each binary symbol, and/or the values of (b-Base) are the same, the values of (Base-a) and (b-Base) are stored as parameters at the frame level, and only one value need be stored each; it is of course also possible to store its value in the memory occupied by the respective model at initialization.
For the embodiment of the application, for each binary symbol in the same frame, when the first probability updating frequency thresholds are different or partially the same, the first probability updating frequency thresholds are stored in the occupied memories of the respective models. And when the second probability updating times threshold value is different from or partially the same as the second probability updating times threshold value, storing the second probability updating times threshold value in the occupied memory of each model.
For the embodiment of the application, when the first probability updating time threshold and/or the second probability updating time threshold are the same for each binary symbol in the same frame, the first probability updating time threshold and/or the second probability updating time threshold are stored in a frame level layer as frame level parameters, and only one value is needed to be stored respectively, and the value can be stored in the occupied memory of each model in the initialization process.
Step S1103 (not shown in the figure): and determining the coding information of the current frame to be decoded, and determining basic probability model parameters (basic right shift numbers) according to the coding information of the current frame to be decoded.
Specifically, the type of the current frame to be decoded is obtained from the input code stream. The frames may be intra-coded frames (I-frames), unidirectional inter-coded frames (P-frames), bi-directional inter-coded frames (B-frames).
Optionally, the encoded information may also include, but is not limited to: a frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
For the embodiment of the application, the basic right shift number of the I frame is Base1, the basic right shift number of the B frame is Base2, and the basic right shift number of the P frame is Base3. The three values of Base1, base2 and Base3 may be identical, may be different from each other, or may be identical in pairs. The embodiment of the application is not limited.
For the embodiment of the application, the value of the basic right shift number can be a consistent value preset by an encoder and a decoder, and can also be read from a code stream by the decoder. The basic right shift number in the embodiment of the application is a consistent value predefined by the encoder and decoder, and does not need to be read from the code stream.
Step S1104 (not shown in the figure): according to the parameters in the binary symbol model of each binary symbol stored in step S1102 and the basic right shift number obtained in step S1103, the large right shift number b and the small right shift number a are calculated and obtained, and the information in the model is updated, that is, the probability P i and the number of model updates cycle in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol bin. The small right shift number a is used to calculate the updated probability P0 and the large right shift number b is used to calculate the updated probability P1.
Specifically, another possible implementation manner in the embodiment of the present application is:
When the probability update times cycle is smaller than the second probability update times threshold, only the value of P0 and P1 is updated to be equal to the updated value of P0. The update rate cwr of P0 is derived from cycle: cwr is a-1 when the cycle is less than the first probability update times threshold; and cwr is a when the cycle is greater than or equal to the first probability update times threshold and less than the second probability update times threshold. Then the first time period of the first time period,
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>cwr–P0i-1>>(cwr+2),P1i=P0i;
If binary symbol bin is LPS,P0i=P0i-1+LG_s,LG_s=log2(2cwr/2cwr-1)x1024,P1i=P0i;
Pi=(P0i+P1i+1)>>1。
When the update times cycle is equal to the second probability update times threshold, P0 and P1 are updated simultaneously, and the update speed of P0 is a and the update speed of P1 is b.
If binary symbol bin is MPS,P0i=P0i-1–P0i-1>>a–P0i-1>>(a+2),P1i=P1i-1–P1i-1>>b–P1i-1>>(b+2);
If binary symbol bin is LPS,P0i=P0i-1+LG_s0,LG_s0=log2(2a/2a-1)x1024,P1i=P1i-1+LG_s1,LG_s1=log2(2b/2b-1)x1024;
Pi=(P0i+P1i+1)>>1。
The updating method of the model updating frequency cycle comprises the following steps: if the binary symbol bin is MPS, if the cycle is equal to 0, the cycle is updated to 1; otherwise, the cycle is unchanged; if the binary symbol bin is LPS, if the cycle is smaller than the second probability updating frequency threshold, adding 1 to the cycle; otherwise, the cycle is unchanged.
Steps 1101 and 1102 in the embodiment of the present application may be replaced by: step S1101a, and step S1102a, wherein,
Step S1101a (not shown in the figure): parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance are obtained.
Wherein the predefined model parameters include, but are not limited to: the absolute value of the difference between the first probability update speed parameter and the base probability update speed parameter and/or the absolute value of the difference between the second probability update speed parameter and the base probability update speed parameter. In an embodiment of the present application, the first probability update speed parameter may include: the large right displacement number b, the second probability update speed parameter may include: the small right displacement number a, the basic probability update speed parameter may include: the Base right shift number Base. The information about the number of probability updates may include: probability number of updates and number of updates threshold.
For the embodiment of the present application, parameters of a binary symbol model of binary symbols of a binary symbol string corresponding to each syntax element defined in advance may be different or the same according to different encoding information of a frame to be decoded. The embodiment of the application is not limited.
Step S1102a (not shown): before decoding the current frame and initializing the binary symbol model of each binary symbol, the predefined model parameters obtained in step S1101a are read in and stored in the memory occupied by each model.
For the embodiment of the application, after all frames are decoded in the above manner, that is, all syntax elements of all frames in the current image are decoded, the reconstructed image is output.
For the embodiment of the application, the compression efficiency of the binary arithmetic coding entropy coding method based on the context can be further improved by setting different model parameters for the binary symbol model of the binary symbol in the binary symbol string of each syntax element under different coding parameters such as different types of frames, different quantization parameters, different image resolutions and the like, so that different updating speeds are adopted when the probability is updated in the updating model. Meanwhile, the difference between the model parameters and the basic model parameters (basic probability update speed parameters) is stored by adopting a difference storage method, so that the method for directly storing the model parameters is replaced, and the storage space can be saved.
For example, in the prior art, 4 bits are used for storing a and b for each binary symbol model, wherein 1<a.ltoreq.b <9, and the value range of 4-bit unsigned numbers is 0 to (2 4 -1), and 8 bits are required in total. If the embodiment of the application is utilized, the basic right shift number 5 is known, the difference (b-5) between the large right shift number and the basic right shift number is stored by using 2 bits for each binary symbol model, the value range of 0.ltoreq.b-5.ltoreq.3, the value range of 2 bit unsigned numbers is 0 to (2 2 -1), the difference (5-a) between the small right shift number and the basic right shift number is stored by using 2 bits, and the total of 0.ltoreq.5-a.ltoreq.3 is required by 4 bits. For VVC, each frame has 702 binary symbol models, and the mode of the embodiment of the application can save the storage space of 4×702 bits per frame; for AVS3, there are 389 binary symbol models per frame, and by means of an embodiment of the present application, 4 x 389 bits per frame can be used. There is also a prior art technique to set the value ranges of a and b to: a is more than or equal to 0 and b is more than or equal to 11, and 4 bits are used for storing a and b respectively. With the embodiment of the present application, if the number of basic right shifts is known to be 5, 3 bits are required to store (5-a) and (b-5), respectively, wherein 0.ltoreq.5-a.ltoreq.4, and 0.ltoreq.b-5.ltoreq.6, each binary symbol model can save 2 bits of storage space compared with the prior art. That is, compared with the method of directly storing large right shift number and small right shift number, the method of the embodiment of the application can greatly save the storage space, and the more the number of frames divided by the image is, the more the saved storage space is, and meanwhile, the coding efficiency of the multi-model CABAC method can be further improved.
The above embodiment describes a model updating method from the viewpoint of a method flow, and describes a model updating device from the viewpoint of a virtual module and/or a virtual unit, specifically as follows:
An embodiment of the present application provides a model updating apparatus, as shown in fig. 3, the model updating apparatus 30 may include: the first obtaining module 31 and the first updating module 32, wherein the model updating device shown in fig. 3 is only one possible example of the model updating device, and is not intended as a limitation of the embodiment of the present application, wherein,
The first obtaining module 31 is configured to obtain first parameters corresponding to respective binary symbol models corresponding to a current frame to be encoded.
The first parameters corresponding to the binary symbol model comprise: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
The first updating module 32 is configured to update the corresponding binary symbol model based on the first parameters corresponding to the binary symbol models.
In one possible implementation manner of the embodiment of the present application, the first parameters corresponding to the binary symbol model further include: related information of probability update times; the related information of the probability updating times comprises the binary symbol model probability updating times and a threshold value of the probability updating times;
in one possible implementation manner of the embodiment of the present application, the first obtaining module 31 is specifically configured to, when obtaining the threshold value of the probability update times: determining coding information of a current frame to be coded; and acquiring the threshold value of the probability updating times based on the coding information of the current frame to be coded.
In another possible implementation manner of the embodiment of the present application, when the first obtaining module 31 obtains the first parameters corresponding to the respective binary symbol models corresponding to the current frame to be encoded, the first obtaining module is specifically configured to: and obtaining first parameters corresponding to each binary symbol model corresponding to the current frame to be coded, which is defined in advance.
In one possible implementation manner of the embodiment of the present application, the apparatus 30 further includes: a first memory module, wherein,
And the first storage module is used for storing the first parameters corresponding to the binary symbol models respectively.
In one possible implementation manner of the embodiment of the present application, the first storage module is specifically configured to store, when initializing each binary symbol model, first parameters corresponding to each binary symbol model corresponding to a current frame to be encoded in a storage space occupied by each binary symbol model.
In one possible implementation manner of the embodiment of the present application, the first storage module is specifically configured to store, when at least one piece of relevant information corresponding to each binary symbol model is the same, the same at least one piece of relevant information as a frame level parameter to a frame level layer, where the at least one piece of relevant information includes: information about the difference between at least one probability update rate parameter and a base probability update rate parameter, and information about the number of probability updates.
In one possible implementation manner of the embodiment of the present application, the first update module 32 includes: a first acquisition unit, a first determination unit and a first updating unit, wherein,
And the first acquisition unit is used for acquiring the basic probability updating speed parameter.
And the first determining unit is used for determining second parameters corresponding to the binary symbol models respectively based on the first parameters corresponding to the binary symbol models respectively and the acquired basic probability updating speed parameters.
The second parameters corresponding to the binary symbol model comprise: at least one probability updates the speed parameter.
And the first updating unit is used for updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In one possible implementation manner of the embodiment of the present application, the first obtaining unit is specifically configured to determine coding information of a current frame to be coded, and obtain a basic probability update speed parameter based on the coding information of the current frame to be coded.
In one possible implementation manner of the embodiment of the present application, the coding information of the current frame to be coded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
In one possible implementation manner of the embodiment of the present application, the apparatus 30 further includes: a write module, wherein,
And the writing module is used for writing the basic probability updating speed parameter into the code stream.
In one possible implementation manner of the embodiment of the present application, the first obtaining module 31 is specifically configured to obtain, from first parameters corresponding to each binary symbol model predefined by the encoder, first parameters corresponding to each binary symbol model corresponding to the current frame to be encoded, and/or obtain, from each predefined binary symbol model corresponding to the current frame to be encoded, first parameters predefined by each binary symbol model.
In one possible implementation manner of the embodiment of the present application, any relevant information corresponding to each binary symbol model includes at least one of the following relationships:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be coded respectively comprise at least one of the following relations:
the basic probability model parameters corresponding to the frames to be coded are different;
The parameters of the basic probability models corresponding to at least two frames to be coded are the same.
In another possible implementation manner of the embodiment of the present application, when the first storage module stores the first parameters corresponding to each binary symbol model, the first storage module is specifically configured to at least one of the following:
When initializing each binary symbol model, storing first parameters corresponding to each binary symbol model into memories corresponding to the binary symbol models;
And when initializing each binary symbol model, storing the first parameters corresponding to each binary symbol model into the memory occupied by each model.
In another possible implementation manner of the embodiment of the present application, the second parameter corresponding to any binary symbol model includes two probability update speed parameters: a first probability update rate parameter for updating a first probability of the binary symbol model and a second probability update rate parameter for updating a second probability of the binary symbol model; the threshold for the number of probability updates in the first parameter of any binary symbol model includes: a first probability update times threshold and a second probability update times threshold, the second probability update times threshold not being less than the first probability update times threshold;
The first updating unit is specifically configured to, when updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models:
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the second parameters respectively corresponding to the binary symbol models and the threshold values of the respective corresponding probability updating times;
And updating the corresponding binary symbol model based on the updated first probability and/or the updated second probability respectively corresponding to the binary symbol models.
In another possible implementation manner of the embodiment of the present application, the first updating unit is specifically configured to, when updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the second parameter corresponding to any binary symbol model and the threshold value of the corresponding probability update times:
Determining whether to update the first probability of any binary symbol model and/or the second probability of any binary symbol model based on the magnitude relation between the probability update times corresponding to any binary symbol model and the second probability update times threshold;
Updating at least one of the first probability of the corresponding binary symbol model and the second probability of the binary symbol model based on the determination result and the second parameter corresponding to any binary symbol model.
Compared with the prior art that the probability update speed parameters corresponding to binary characters are stored in a memory when the model is updated, the embodiment of the application obtains the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded and the basic probability update speed parameter, and updates each binary symbol model through the obtained at least one relevant information corresponding to each binary symbol model, namely, when the model is initialized, only the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded and the basic probability update speed parameter is needed to be stored, instead of directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the relevant information of the difference value between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
The embodiment of the present application provides another model updating apparatus, as shown in fig. 4, where the model updating apparatus shown in fig. 4 is only one possible example and is not to be taken as a limitation of the embodiment of the present application, and the model updating apparatus 40 may include: a second acquisition module 41, and a second update module 42, wherein,
The second obtaining module 41 is configured to obtain first parameters corresponding to respective binary symbol models corresponding to the current frame to be decoded.
The first parameters corresponding to the binary symbol model comprise: information about a difference between at least one probability update rate parameter and a base probability update rate parameter;
a second updating module 42, configured to update the corresponding binary symbol models based on the first parameters corresponding to the binary symbol models.
In one possible implementation manner of the embodiment of the present application, the first parameters corresponding to the binary symbol model further include: probability update times related information the related information of the probability update times includes: the number of probability updates and the threshold value of the number of probability updates.
In another possible implementation manner of the embodiment of the present application, when the second obtaining module obtains the threshold value of the probability update times, the second obtaining module is specifically configured to:
determining coding information of a current frame to be decoded;
and acquiring a threshold value of the probability updating times based on the coding information of the current frame to be decoded.
In one possible implementation manner of the embodiment of the present application, the apparatus 40 further includes: a second memory module, wherein,
And the second storage module is used for storing the first parameters corresponding to the binary symbol models respectively.
In another possible implementation manner of the embodiment of the present application, the second storage module is specifically configured to store, when initializing each binary symbol model, first parameters corresponding to each binary symbol model corresponding to a current frame to be decoded into storage spaces occupied by each binary symbol model.
In one possible implementation manner of the embodiment of the present application, the second storage module is specifically configured to store, when at least one piece of relevant information corresponding to each binary symbol model is the same, the same at least one piece of relevant information as a frame level parameter to a frame level layer, where the at least one piece of relevant information is relevant information of a difference between the at least one probability update speed parameter and the basic probability update speed parameter.
In one possible implementation manner of the embodiment of the present application, the second updating module 42 includes: a second acquisition unit, a second determination unit, and a second update unit, wherein,
And the second acquisition unit is used for acquiring the basic probability updating speed parameter.
And the second determining unit is used for determining second parameters corresponding to the binary symbol models respectively based on the first parameters corresponding to the binary symbol models respectively stored in the memory and the acquired basic probability updating speed parameters.
The second parameters corresponding to the binary symbol model comprise: at least one probability updates the speed parameter.
And the second updating unit is used for updating the corresponding binary symbol model based on the second parameters respectively corresponding to the binary symbol models.
In one possible implementation manner of the embodiment of the present application, the second obtaining unit is specifically configured to obtain a basic probability update speed parameter from a code stream, and/or obtain the basic probability update speed parameter based on coding information of a current frame to be decoded.
In one possible implementation manner of the embodiment of the present application, the encoding information of the current frame to be decoded includes at least one of the following:
A frame type; a quantization parameter; image resolution; a time layer mark; POC (point of care); a coding configuration; GOP structure.
In one possible implementation manner of the embodiment of the present application, the second obtaining module 41 is specifically configured to obtain, from first parameters corresponding to each binary symbol model predefined by the decoder, first parameters corresponding to each binary symbol model corresponding to the current frame to be decoded, and/or obtain, from each predefined binary symbol model corresponding to the current frame to be decoded, first parameters predefined by each binary symbol model.
In one possible implementation manner of the embodiment of the present application, any relevant information corresponding to each binary symbol model includes at least one of the following relationships:
Any relevant information corresponding to each binary symbol model is different;
Any relevant information corresponding to the at least two binary symbol models is the same;
The basic probability model parameters corresponding to each frame to be decoded respectively comprise at least one of the following relations:
The basic probability model parameters corresponding to the frames to be decoded are different;
the basic probability model parameters corresponding to at least two frames to be decoded are the same.
Compared with the prior art that the probability update speed parameters corresponding to binary characters are stored in the memory when the model is updated, the embodiment of the application obtains the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded and the basic probability update speed parameter, and updates each binary symbol model through the obtained at least one relevant information corresponding to each binary symbol model, namely, when the model is initialized, only the relevant information of the difference value between at least one probability update speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded and the basic probability update speed parameter is needed to be stored, instead of directly storing the at least one probability update speed parameter corresponding to each binary symbol model, and the storage space occupied by the relevant information of the difference value between the probability update speed parameter and the basic probability update speed parameter is smaller than the storage space occupied by directly storing the probability update speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
Notably, are: the two model updating devices may be one model updating device or two model updating devices, which is not limited in the embodiment of the present application. In the embodiment of the present application, if the two model updating apparatuses are the same model updating apparatus, the "first" and the "second" are not limited to the modules or units. For example, the "first update module" and the "second update module" may be the same update module or different update modules.
The above device embodiments are applicable to the above method embodiments, and are not described herein.
An embodiment of the present application provides an electronic device, as shown in fig. 5, an electronic device 500 shown in fig. 5 includes: a processor 501, and a memory 503. The processor 501 is coupled to a memory 503, such as via a bus 502. Optionally, the electronic device 500 may also include a communication interface 504, including an antenna. It should be noted that, in practical applications, the communication interface 504 is not limited to one, and the structure of the electronic device 500 is not limited to the embodiment of the present application.
The processor 501 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 501 may also be a combination that implements computing functionality, such as a combination comprising one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
Bus 502 may include a path to transfer information between the components. Bus 502 may be a PCI bus, an EISA bus, or the like. The bus 502 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
The memory 503 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact discs, laser discs, optical disks, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 503 is used to store computer program code for performing the aspects of the present application and is controlled by the processor 501 for execution. The processor 501 is configured to execute computer program code stored in the memory 503 to implement what is shown in any of the method embodiments described above.
The embodiment of the application provides an electronic device, which comprises: a memory and a processor; at least one program stored in the memory for execution by the processor, which, when executed by the processor, performs: according to the embodiment of the application, the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded is obtained, and the binary symbol models are updated through the obtained at least one related information corresponding to each binary symbol model, namely, in the initialization process of the model, only the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be encoded is needed to be stored, instead of directly storing the at least one probability updating speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference value between the probability updating speed parameter and the basic probability updating speed parameter is smaller than the storage space occupied by the direct storage probability updating speed parameter, so that the storage space occupied by the parameters for model updating can be reduced.
The electronic device may be an encoder or an electronic device having both encoding and decoding functions. The embodiment of the application is not limited.
The embodiment of the application provides another electronic device, which comprises: a processor and a memory. Wherein the processor is coupled to the memory, such as via a bus. Optionally, the electronic device may further comprise a communication interface, the communication interface comprising an antenna. It should be noted that, in practical application, the communication interface is not limited to one, and the structure of the electronic device does not limit the embodiment of the present application.
The processor may be a CPU, general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
A bus may include a path that communicates information between the components. The bus may be a PCI bus or an EISA bus, etc. The buses may be divided into address buses, data buses, control buses, etc.
The memory may be, but is not limited to, ROM or other type of static storage device, RAM or other type of dynamic storage device, which can store static information and instructions, EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disc, etc.), magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory is used for storing computer program codes for executing the scheme of the application, and the execution is controlled by the processor. The processor is configured to execute the computer program code stored in the memory to implement what is shown in any of the method embodiments described above.
The embodiment of the application provides an electronic device, which comprises: a memory and a processor; at least one program stored in the memory for execution by the processor, which, when executed by the processor, performs: according to the embodiment of the application, the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded is obtained, and the binary symbol models are updated through the obtained at least one related information corresponding to each binary symbol model, namely, when the model is initialized, only the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded is needed to be stored, instead of directly storing the at least one probability updating speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference value between the probability updating speed parameter and the basic probability updating speed parameter is smaller than the storage space occupied by the direct storage probability updating speed parameter, so that the storage space occupied by the parameters for model updating can be reduced.
The electronic device may be a decoder or an electronic device having both a decoding function and an encoding function. The embodiment of the application is not limited.
For the embodiment of the present application, the two types of electronic devices are an encoder and a decoder, respectively, or one type of electronic device having a decoding function and an encoding function. The embodiment of the application is not limited.
The technical solution of the present application is described above from the aspects of a method flow, a virtual device, and a physical device, and the following description describes the technical solution of the present application from the perspective of a computer readable storage medium, which is specifically as follows:
Embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which when run on a computer, causes the computer to perform the corresponding method embodiments described above. Compared with the prior art, the embodiment of the application acquires the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be coded, and updates each binary symbol model through the acquired at least one related information corresponding to each binary symbol model, namely, when the model is initialized, only the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be coded is needed to be stored, instead of directly storing the at least one probability updating speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference value between the probability updating speed parameter and the basic probability updating speed parameter is smaller than the storage space occupied by the direct storage probability updating speed parameter, so that the storage space occupied by the parameters for model updating can be reduced.
An embodiment of the present application provides another computer-readable storage medium having stored thereon a computer program which, when run on a computer, causes the computer to perform the corresponding content of the method embodiments described above. Compared with the prior art, the embodiment of the application acquires the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded, and updates each binary symbol model through the acquired at least one related information corresponding to each binary symbol model, namely, when the model is initialized, only the related information of the difference value between the at least one probability updating speed parameter and the basic probability updating speed parameter corresponding to each binary symbol model corresponding to the current frame to be decoded is needed to be stored, instead of directly storing the at least one probability updating speed parameter corresponding to each binary symbol model, and the storage space occupied by the related information of the difference value between the probability updating speed parameter and the basic probability updating speed parameter is smaller than the storage space occupied by the direct storage probability updating speed parameter, so that the storage space occupied by the parameters for model updating can be reduced.
The above-mentioned computer readable storage medium is applicable to the above-mentioned method embodiments, and is not described herein.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present invention, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.

Claims (2)

1. A method of updating a model, comprising:
Determining a first probability update rate parameter and a second probability update rate parameter based on the base probability update rate parameter;
Acquiring a set of a first threshold value of a probability update number and a second threshold value of the probability update number based on a frame type of a current frame, wherein the frame type belongs to one of the following frame types: an intra-coded frame I frame, a unidirectional inter-coded frame P frame, and a bidirectional inter-coded frame B frame, the first threshold of the probability update times being less than the second threshold of the probability update times;
When the probability updating frequency related information Cycle is equal to a second threshold value of the probability updating frequency, updating a first binary symbol model of the current frame by using the first probability updating speed parameter, and updating a second binary symbol model of the current frame by using the second probability updating speed parameter;
When the probability update times related information Cycle is larger than a first threshold value of the probability update times and smaller than a second threshold value of the probability update times, updating a first binary symbol model of a current frame by using the first probability update speed parameter, and updating the second binary symbol model to be the same as the updated first binary symbol model;
acquiring a binary symbol model by using the first binary symbol model and the second binary symbol model; and
Entropy decoding the binary symbols using the binary symbol model,
Wherein the first probability update rate parameter of the P frame is the same as the first probability update rate parameter of the B frame, and the second probability update rate parameter of the P frame is the same as the second probability update rate parameter of the B frame.
2. A method of updating a model, comprising:
Determining a first probability update rate parameter and a second probability update rate parameter based on the base probability update rate parameter;
Acquiring a first threshold value of probability updating times and a second threshold value of probability updating times according to a frame type of a current frame, wherein the frame type belongs to one of the following frame types: an intra-coded frame I frame, a unidirectional inter-coded frame P frame, and a bidirectional inter-coded frame B frame, the first threshold of the probability update times being less than the second threshold of the probability update times;
When the probability update times related information Cycle is equal to a second threshold value of the probability update times, updating a first binary symbol model of the current frame by using the first probability update speed parameter, and updating a second binary symbol model of the current frame by using the second probability update speed parameter;
when the probability update times related information Cycle is larger than a first threshold value of the probability update times; and updating a first binary symbol model of the current frame using the first probability update rate parameter and updating the second binary symbol model to be the same as the updated first binary symbol model;
Acquiring a binary symbol model by using the first binary symbol model and the second binary symbol model; and
Entropy encoding the binary symbols using the updated binary symbol model,
Wherein the first probability update rate parameter of the P frame is the same as the first probability update rate parameter of the B frame, and the second probability update rate parameter of the P frame is the same as the second probability update rate parameter of the B frame.
CN202410309590.XA 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium Pending CN118200585A (en)

Applications Claiming Priority (7)

Application Number Priority Date Filing Date Title
CN201910502457 2019-06-11
CN2019105024575 2019-06-11
CN201910730604 2019-08-08
CN2019107306044 2019-08-08
CN201911077392 2019-11-06
CN2019110773920 2019-11-06
CN202010152701.2A CN112073729B (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202010152701.2A Division CN112073729B (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN118200585A true CN118200585A (en) 2024-06-14

Family

ID=73657960

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202010152701.2A Active CN112073729B (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium
CN202410309592.9A Pending CN118200586A (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium
CN202410309590.XA Pending CN118200585A (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium

Family Applications Before (2)

Application Number Title Priority Date Filing Date
CN202010152701.2A Active CN112073729B (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium
CN202410309592.9A Pending CN118200586A (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium

Country Status (4)

Country Link
EP (1) EP3984221A4 (en)
CN (3) CN112073729B (en)
BR (1) BR112021023379A2 (en)
WO (1) WO2020251261A1 (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120314760A1 (en) * 2011-06-10 2012-12-13 Research In Motion Limited Method and system to reduce modelling overhead for data compression
JP5900024B2 (en) * 2012-03-02 2016-04-06 沖電気工業株式会社 Moving picture encoding apparatus and program, moving picture decoding apparatus and program, and moving picture distribution system
US10097833B2 (en) * 2014-12-26 2018-10-09 Intel Corporation Method and system of entropy coding using look-up table based probability updating for video coding
KR102051200B1 (en) * 2015-05-19 2019-12-02 미디어텍 인크. Method and apparatus for context-adaptive binary arithmetic coding based on multiple tables
US10368072B2 (en) * 2015-05-29 2019-07-30 Qualcomm Incorporated Advanced arithmetic coder
EP3273692A4 (en) * 2015-06-10 2018-04-04 Samsung Electronics Co., Ltd. Method and apparatus for encoding or decoding image using syntax signaling for adaptive weight prediction
EP3629581A1 (en) * 2015-10-13 2020-04-01 Samsung Electronics Co., Ltd. Method and device for encoding or decoding image
US10547854B2 (en) * 2016-05-13 2020-01-28 Qualcomm Incorporated Neighbor based signaling of intra prediction modes
US10554988B2 (en) * 2017-03-22 2020-02-04 Qualcomm Incorporated Binary arithmetic coding with parameterized probability estimation finite state machines
US10560723B2 (en) * 2017-05-08 2020-02-11 Qualcomm Incorporated Context modeling for transform coefficient coding
US11039143B2 (en) * 2017-11-20 2021-06-15 Qualcomm Incorporated Memory reduction for context initialization with temporal prediction

Also Published As

Publication number Publication date
BR112021023379A2 (en) 2022-04-26
EP3984221A4 (en) 2023-05-03
CN112073729B (en) 2024-04-05
EP3984221A1 (en) 2022-04-20
CN118200586A (en) 2024-06-14
WO2020251261A1 (en) 2020-12-17
CN112073729A (en) 2020-12-11

Similar Documents

Publication Publication Date Title
CN109997361B (en) Low complexity symbol prediction for video coding
US10735749B2 (en) Coded-block-flag coding and derivation
CN103748886B (en) Support the entropy code of pattern switching
US7304590B2 (en) Arithmetic decoding apparatus and method
US10554988B2 (en) Binary arithmetic coding with parameterized probability estimation finite state machines
TWI827010B (en) Arithmetic encoders, arithmetic decoders, video encoder, video decoder, methods for encoding, methods for decoding and computer program
JPH04223717A (en) Method for data compression, method for selection of system and dynamic model, and system
US8254700B1 (en) Optimized method and system for entropy coding
KR20130140190A (en) Methods and devices for coding and decoding the position of the last significant coefficient
CN109936742B (en) Method for encoding a video sequence, encoding device and storage medium
CA3075491A1 (en) Binary arithmetic coding with progressive modification of adaptation parameters
US11234023B2 (en) Features of range asymmetric number system encoding and decoding
TW201724852A (en) Parallel arithmetic coding techniques
CN111818335B (en) Entropy coding method and device and electronic equipment
CN112073729B (en) Model updating method, device, electronic equipment and computer readable storage medium
CN110545437B (en) Coefficient encoding method, coefficient decoding method, electronic device, and medium
CN110035288B (en) Method for encoding a video sequence, encoding device and storage medium
US8675730B2 (en) Macroblock grouping in a destination video frame to improve video reconstruction performance
CN112449186B (en) Encoding method, decoding method, corresponding devices, electronic equipment and storage medium
CN106063269B (en) Moving picture encoding device, dynamic image decoding device and moving picture encoding/coding/decoding method
KR20120038355A (en) Method and apparatus of entropy encoding/decoding and symbol endcoding/decoding method and apparatus therefor
CN114079774A (en) Method and device for encoding and decoding inter-frame prediction information
CN114556430A (en) Data processing method and device, image signal processor and movable platform
CN117119189A (en) Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding
TW202435611A (en) Arithmetic encoders, arithmetic decoders, video encoder, video decoder, methods for encoding, methods for decoding and computer program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination