CN112073729B - 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
CN112073729B
CN112073729B CN202010152701.2A CN202010152701A CN112073729B CN 112073729 B CN112073729 B CN 112073729B CN 202010152701 A CN202010152701 A CN 202010152701A CN 112073729 B CN112073729 B CN 112073729B
Authority
CN
China
Prior art keywords
binary symbol
probability
model
updating
frame
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.)
Active
Application number
CN202010152701.2A
Other languages
Chinese (zh)
Other versions
CN112073729A (en
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
Priority to CN202410309592.9A priority Critical patent/CN118200586A/en
Priority to CN202410309590.XA priority patent/CN118200585A/en
Priority to BR112021023379A priority patent/BR112021023379A2/en
Priority to PCT/KR2020/007534 priority patent/WO2020251261A1/en
Priority to EP20822571.4A priority patent/EP3984221A4/en
Publication of CN112073729A publication Critical patent/CN112073729A/en
Application granted granted Critical
Publication of CN112073729B publication Critical patent/CN112073729B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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/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/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 Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (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. According to the embodiment of the application, the storage space occupied by the parameters for updating the model can be saved.

Description

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, such as the second algebraic audio video codec standard (Audio Video Coding Standard, avs 2), h.264/AVC and high efficiency video codec (High Efficiency Video Coding, HEVC), binary symbol strings after binarization of syntax elements are entropy coded using a Context-based adaptive binary arithmetic coding (CABAC) method to further increase compression ratio.
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 decoded, 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., the 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 beneficial effects that this application provided technical scheme brought are:
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 related information of differences 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 differences 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 differences 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, the electronic equipment and the computer readable storage medium acquire related information of differences 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 differences 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 differences 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 disclosure;
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 device according to an embodiment of the present disclosure;
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 the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of illustrating the present application and are not to be construed as limiting the invention.
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 below 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 MPS probability information (lg_p MPS ) Probability of being MPS (P MPS ) Converting into a value of a logarithmic domain, wherein a calculation formula is LG_P MPS =1024x(-log 2 (P MPS )). bin is ithThe next-occurring binary symbol, 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_P i-1 –P i-1 >>cwr–P i-1 >>(cwr+2);
If binary symbol bin is LPS, P i =P i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024.
In the joint video expert group (Joint Video Experts Team, jfet) 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.
P i =γb i +(1-γ)P i-1 (1)
The probability P is represented by an integer P, the maximum of which is y=2 k -1, wherein the integer P is represented by k bits, then equation (1) can be written as equation (2), N being the number of right shifts in equation (2), corresponding to the probability update rate, γ=1/2 N Wherein, gamma is a parameter for calculating updated p, and N is a parameter for calculating updated pThe larger the parameter of P, the smaller the value of N and the smaller the value of gamma, the slower the model updating speed, the smaller the interference of random noise, and the more accurate the estimated probability; 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:
P i =P i-1 +((2 k -P i-1 )>>N) (2)
wherein P in formula (2) i-1 Is the probability value after the previous (i-1 th) binary symbol appears, the probability value P after the i-th appearance i Equal to the right-hand equation of equation (2).>>In order to shift the operator to the right by bit,>>n represents shifting by N bits to the right.
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:
P0 i =(Y>>a)+P0 i-1 –(P0 i-1 >>a)
P1 i =(Y>>b)+P1 i-1 –(P0 i-1 >>b)
P i =(P0 i +P1 i +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, respectively, 1 of which<a≤b<The value range of the unsigned number of 9,4 bits 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 present application proposes a method of storing offset values, i.e. only the difference between the large right shift number and the basic right shift number and the difference between the small right shift number and the basic right shift number, on the premise that the basic right shift number is known. For example, in the prior art, 4 bits are used to store a and 4 for each binary symbol model, respectively A bit store b of 1<a≤b<The value range of the unsigned number of 9,4 bits is 0 to (2) 4 -1) a total of 8 bits are required. 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) using 2 bits to store the difference (5-a) between the small right shift number and the basic right shift number, 0.ltoreq.5-a.ltoreq.3, requiring a total of 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 using the present application can result in a 4 x 389 bit savings per frame. 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 solutions of the present application and how the technical solutions of the present application solve 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.
In another possible implementation manner of the embodiment of the present application, 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 invention 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 includes 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 present application, the first parameters corresponding to all binary symbol models correspond to a specific storage space 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 present 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 encoded may 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 this 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 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, 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 present embodiments also provide another method of decoding, 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.
In another possible implementation manner of the embodiment of the present application, 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 the memory when the model is updated, the embodiment of the invention 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, 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 present 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 may 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 this 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, where each coded image may 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 the embodiments of the present application, any binary symbol model parameters 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 present embodiment, the value of the large right displacement number is greater 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 may occupy 1 bit, 2 bits or 3 bits of memory space. In the embodiment of the present application, the absolute value of the difference between the first probability update speed parameter and the basic probability update speed parameter may occupy a storage space of 1 bit, 2 bits, or 3 bits; 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 embodiments of the present 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.
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) may 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 embodiments of the present application are not limited thereto.
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) may 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 (the 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 (the 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 shift 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 shift number) can be the same or different from any combination in the coding information of the frame to be coded.
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 may be written into the code stream before the frame to be encoded is encoded.
Step S304 (not shown in the figure): calculating the large right shift number b and the small right shift number a according to the parameters in the binary symbol model of each binary symbol stored in the step S302 and the basic right shift number obtained in the step S303, and updating the information in the model, namely updating the LPS probability P in the binary symbol model of the binary symbol after the ith occurrence of the binary symbol i Maximum value y=2 k
P0 i =(Y>>a)+P0 i-1 –(P0 i-1 >>a)
P1 i =(Y>>b)+P1 i-1 –(P0 i-1 >>b)
P i =(P0 i +P1 i +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 present application further provides another method for entropy encoding in an encoder, where each encoded image may be divided into one frame or at least two frames, which 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 embodiments of the present application, the predefined model parameters that are predefined may be different or the same according to the coding parameters. The embodiments of the present application are not limited thereto.
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 the 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 numbers) obtained in step S403, respectively calculating the first probability update rate parameters and/or the second probability update rate parameters (large right shift number b and/or small right shift number a) respectively corresponding to each binary symbol model, and updating the information in the model, namely updating the LPS (least possible character) probability P in the binary symbol model of the binary symbol after the ith binary symbol appears i Maximum value y=2 k
P0 i =(Y>>a)+P0 i-1 –(P0 i-1 >>a)
P1 i =(Y>>b)+P1 i-1 –(P0 i-1 >>b)
P i =(P0 i +P1 i +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 the embodiments of the present application, any binary symbol model parameters 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 embodiments of the present 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 present 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 present 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 embodiments of the present application are not limited thereto.
For the embodiments of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, or may be read from the code stream by the decoder. The basic right shift number in the embodiment of the present application is a consistent value predefined by the encoder and decoder, and need not 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, calculating and obtaining the first probability update rate parameter and/or the second probability update rate parameter (the large right shift number b and/or the small right shift number a) corresponding to each binary symbol model respectively, and updating the information in the model, namely updating the probability P (the smallest possible character) of LPS (the smallest possible character) in the probability model of the binary symbol after the ith binary symbol appears i Maximum value y=2 k
P0 i =(Y>>a)+P0 i-1 –(P0 i-1 >>a)
P1 i =(Y>>b)+P1 i-1 –(P0 i-1 >>b)
P i =(P0 i +P1 i +1)>>1
For the embodiment of the present 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 present application further provides a method for entropy encoding in a decoder, where 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 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 coding information of a frame to be decoded. The embodiments of the present application are not limited thereto.
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): calculating the large right shift number b and the small right shift number a based on 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, and updating the information in the model, that is, updating the probability P of LPS (least probable character) in the probability model of the binary symbol after the occurrence of the ith binary symbol i Maximum value y=2 k
P0 i =(Y>>a)+P0 i-1 –(P0 i-1 >>a)
P1 i =(Y>>b)+P1 i-1 –(P0 i-1 >>b)
P i =(P0 i +P1 i +1)>>1
For the embodiment of the present 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, where each coded image may 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 the embodiments of the present application, any binary symbol model parameters 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 present embodiment, the value of the large right displacement number is greater 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 may occupy 1 bit, 2 bits or 3 bits of memory space. In the embodiment of the present application, the absolute value of the difference between the first probability update speed parameter and the basic probability update speed parameter may occupy a storage space of 1 bit, 2 bits, or 3 bits; 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 embodiments of the present 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.
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) may 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 embodiments of the present application are not limited thereto. 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) may 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 (the 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 (the 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 shift 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 shift number) can be the same or different from any combination in the coding information of the frame to be coded.
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 may be written into the code stream before the frame to be encoded is encoded.
Step S804 (not shown in the figure): calculating the large right shift number b and the small right shift number a 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, and updating the information in the model, namely updating the probability P in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol bin i And related information cycle of the model update times. 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 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, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 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, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 embodiments of the present application, the predefined model parameters that are predefined may be different or the same according to the coding parameters. The embodiments of the present application are not limited thereto.
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 the embodiments of the present application, any binary symbol model parameters 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 embodiments of the present 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 present 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 present 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 embodiments of the present application are not limited thereto.
For the embodiments of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, or may be read from the code stream by the decoder. The basic right shift number in the embodiment of the present application is a consistent value predefined by the encoder and decoder, and need not be read from the code stream.
Step S904 (not shown in the figure): calculating the large right shift number b and the small right shift number a based on 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, and updating the information in the model, i.e. after the occurrence of the ith binary symbol binUpdating probability P in a binary symbol model of the binary symbol i And related information cycle of the model update times. 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 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, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 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, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 coding information of a frame to be decoded. The embodiments of the present application are not limited thereto.
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 present 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, where each coded image may 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 the embodiments of the present application, any binary symbol model parameters 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 present embodiment, the value of the large right displacement number is greater 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 may occupy 1 bit, 2 bits or 3 bits of memory space. In the embodiment of the present application, the absolute value of the difference between the first probability update speed parameter and the basic probability update speed parameter may occupy a storage space of 1 bit, 2 bits, or 3 bits; 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 the 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 current information to be encoded, and for the embodiment of the present application, the probability update frequency threshold is determined according to a type of a 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 a 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 present application, the frame types of the frames to be encoded are different, and the first probability update times thresholds may be the same or different, and the second probability update times thresholds may 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 embodiments of the present application are not limited thereto.
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 embodiments of the present application are not limited thereto.
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 be 8, 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 embodiments of the present 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, when the first probability updating frequency thresholds are different or partially the same for each binary symbol in the same frame, the first probability updating frequency thresholds are stored in the respective model occupied memories. 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 frequency threshold and/or the second probability updating frequency threshold are the same for each binary symbol in the same frame, the first probability updating frequency threshold and/or the second probability updating frequency threshold are stored in the frame level layer as frame level parameters, and only one value is required to be stored respectively, and the value can be stored in the occupied memory of each model in the initializing 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) may 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 embodiments of the present application are not limited thereto. 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) may 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 (the 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 (the 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 shift 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 shift number) can be the same or different from any combination in the coding information of the frame to be coded.
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 may be written into the code stream before the frame to be encoded is encoded.
Step S1004 (not shown in the figure): calculating the large right shift number b and the small right shift number a based on 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, and updating the information in the model, that is, updating the probability P in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol bin i And model update times cycle. 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; when the cycle is greater than or equal to the first probability update times threshold and less than the second probability update times threshold, cwr is a. Then the first time period of the first time period,
if binary symbol bin is MPS, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 embodiments of the present application, the predefined model parameters that are predefined may be different or the same according to the coding parameters. The embodiments of the present application are not limited thereto.
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 the embodiments of the present application, any binary symbol model parameters 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 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 the probability update times threshold of any binary symbol model may be determined according to the coding information of the current frame to be decoded, and for this embodiment of the present application, the probability update times threshold is determined according to the type of the frame to be decoded, the first probability update times threshold of each binary symbol model in the same frame is the same, the second probability update times threshold is the same, and the first probability update times threshold and the second probability update times 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 present application, the frame types of the frames to be decoded are different, and the first probability update times threshold may be the same or different, and the second probability update times threshold may 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 embodiments of the present application are not limited thereto.
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 embodiments of the present application are not limited thereto.
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 embodiments of the present 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 present 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, when the first probability updating frequency thresholds are different or partially the same for each binary symbol in the same frame, the first probability updating frequency thresholds are stored in the respective model occupied memories. 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 frequency threshold and/or the second probability updating frequency threshold are the same for each binary symbol in the same frame, the first probability updating frequency threshold and/or the second probability updating frequency threshold are stored in the frame level layer as frame level parameters, and only one value is required to be stored respectively, and the value can be stored in the occupied memory of each model in the initializing 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 present 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 embodiments of the present application are not limited thereto.
For the embodiments of the present application, the value of the basic right shift number may be a consistent value predefined by the encoder and decoder, or may be read from the code stream by the decoder. The basic right shift number in the embodiment of the present application is a consistent value predefined by the encoder and decoder, and need not be read from the code stream.
Step S1104 (not shown in the figure): calculating the large right shift number b and the small right shift number a 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, and updating the information in the model, namely updating the probability P in the binary symbol model of the binary symbol after the occurrence of the ith binary symbol bin i And model update times cycle. 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; when the cycle is greater than or equal to the first probability update times threshold and less than the second probability update times threshold, cwr is a. Then the first time period of the first time period,
If binary symbol bin is MPS, P0 i =P0 i-1 –P0 i-1 >>cwr–P0 i-1 >>(cwr+2),P1 i =P0 i
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s,LG_s=log 2 (2 cwr /2 cwr -1)x1024,P1 i =P0 i
P i =(P0 i +P1 i +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, P0 i =P0 i-1 –P0 i-1 >>a–P0 i-1 >>(a+2),P1 i =P1 i-1 –P1 i-1 >>b–P1 i-1 >>(b+2);
If binary symbol bin is LPS, P0 i =P0 i-1 +LG_s0,LG_s0=log 2 (2 a /2 a -1)x1024,P1 i =P1 i-1 +LG_s1,LG_s1=log 2 (2 b /2 b -1)x1024;
P i =(P0 i +P1 i +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 coding information of a frame to be decoded. The embodiments of the present application are not limited thereto.
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 present 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, 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, different updating speeds are adopted when updating the probability in the updating model, and the compression efficiency of the binary arithmetic coding entropy coding method based on the context is further improved. 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, respectively, for each binary symbol model, 1<a≤b<The value range of the unsigned number of 9,4 bits is 0 to (2) 4 -1) a total of 8 bits are required. If using the embodiment of the present application, 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) using 2 bits to store the difference (5-a) between the small right shift number and the basic right shift number, 0.ltoreq.5-a.ltoreq.3, requiring a total of 4 bits. For VVCIn other words, each frame has 702 binary symbol models, and by using the mode of the embodiment of the application, the storage space of 4×702 bits can be saved for each frame; for AVS3, there are 389 binary symbol models per frame, and 4 x 389 bits per frame can be used in the manner of the embodiments of the present application. 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 embodiments of the present application, if the number of basic right shifts is known to be 5, then 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, saving 2 bits of storage space per binary symbol model as compared to the prior art. That is, compared with the method of directly storing the large right shift number and the small right shift number, the method of the embodiment of the application can greatly save the storage space, 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:
the embodiment of the present application provides a model updating device, as shown in fig. 3, the model updating device 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 to be taken 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 parameter corresponding to the binary symbol model further includes: 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 this 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 this embodiment of the present application, when the first obtaining module 31 obtains the first parameters corresponding to each binary symbol model 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 updating 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 the 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 this embodiment of the present application, the first obtaining module 31 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 a 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 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 this embodiment of the present application, when the first storage module stores the first parameters corresponding to each binary symbol model respectively, 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 this 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 this embodiment of the present application, 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, the first updating unit is specifically configured to:
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 invention 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 parameter corresponding to the binary symbol model further includes: 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 this 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 at least one probability update speed parameter and a 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 this 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, respective 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, respective first parameters predefined by the decoder.
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 the directly stored 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 component, 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 executing the aspects of the present application and is controlled to be executed by the processor 501. 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.
An embodiment of the present application provides an electronic device, where the electronic device in the embodiment of the present application includes: 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 method and the device for updating the binary symbol model, 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 embodiments of the present application are not limited thereto.
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 is not limited to 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.
An embodiment of the present application provides an electronic device, where the electronic device in the embodiment of the present application includes: 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 method and the device for updating the binary symbol model, 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 updating the model can be reduced.
The electronic device may be a decoder or an electronic device having both a decoding function and an encoding function. The embodiments of the present application are not limited thereto.
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 embodiments of the present application are not limited thereto.
The above technical solutions of the present application are described from the aspects of a method flow, a virtual device, and an entity device, and the following technical solutions of the present application are described from the perspective of a computer readable storage medium, which are specifically as follows:
the present application provides 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 method and the device for updating the binary symbol model acquire 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, and update 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 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 directly storing the probability updating speed parameter, so that the storage space occupied by the parameters for updating the model can be reduced.
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 foregoing method embodiments. Compared with the prior art, the method and the device for updating the binary symbol model acquire 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 update 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 directly storing the probability updating speed parameter, so that the storage space occupied by the parameters for updating the model 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 symbol using the binary symbol model.
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 symbol using the updated binary symbol model.
CN202010152701.2A 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium Active CN112073729B (en)

Priority Applications (5)

Application Number Priority Date Filing Date Title
CN202410309592.9A CN118200586A (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium
CN202410309590.XA CN118200585A (en) 2019-06-11 2020-03-06 Model updating method, device, electronic equipment and computer readable storage medium
BR112021023379A BR112021023379A2 (en) 2019-06-11 2020-06-10 Method to update a model
PCT/KR2020/007534 WO2020251261A1 (en) 2019-06-11 2020-06-10 Method for updating model, apparatus, electronic device and computer readable storage medium
EP20822571.4A EP3984221A4 (en) 2019-06-11 2020-06-10 Method for updating model, apparatus, electronic device and computer readable storage medium

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
CN2019105024575 2019-06-11
CN201910502457 2019-06-11
CN201910730604 2019-08-08
CN2019107306044 2019-08-08
CN2019110773920 2019-11-06
CN201911077392 2019-11-06

Related Child Applications (2)

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

Publications (2)

Publication Number Publication Date
CN112073729A CN112073729A (en) 2020-12-11
CN112073729B true CN112073729B (en) 2024-04-05

Family

ID=73657960

Family Applications (3)

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

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

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202410309590.XA Pending CN118200585A (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) CN118200586A (en)
BR (1) BR112021023379A2 (en)
WO (1) WO2020251261A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107005697A (en) * 2014-12-26 2017-08-01 英特尔公司 Method and system for the entropy coding of probability updating of the use based on look-up table of video coding
CN107534772A (en) * 2015-05-19 2018-01-02 联发科技股份有限公司 The method and device of context adaptive binary arithmetic coding based on multilist
CN107667533A (en) * 2015-05-29 2018-02-06 高通股份有限公司 Advanced mathematical decoder
CN107787582A (en) * 2015-06-10 2018-03-09 三星电子株式会社 The method and apparatus for being encoded or being decoded to image using the grammer signaling for adaptive weighted prediction
CN108141594A (en) * 2015-10-13 2018-06-08 三星电子株式会社 For being encoded to image or decoded method and apparatus
CN109196869A (en) * 2016-05-13 2019-01-11 高通股份有限公司 Intra prediction mode based on neighbouring signalling

Family Cites Families (5)

* 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
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107005697A (en) * 2014-12-26 2017-08-01 英特尔公司 Method and system for the entropy coding of probability updating of the use based on look-up table of video coding
CN107534772A (en) * 2015-05-19 2018-01-02 联发科技股份有限公司 The method and device of context adaptive binary arithmetic coding based on multilist
CN107667533A (en) * 2015-05-29 2018-02-06 高通股份有限公司 Advanced mathematical decoder
CN107787582A (en) * 2015-06-10 2018-03-09 三星电子株式会社 The method and apparatus for being encoded or being decoded to image using the grammer signaling for adaptive weighted prediction
CN108141594A (en) * 2015-10-13 2018-06-08 三星电子株式会社 For being encoded to image or decoded method and apparatus
CN109196869A (en) * 2016-05-13 2019-01-11 高通股份有限公司 Intra prediction mode based on neighbouring signalling

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
JVET-A1001:Algorithm Description of Joint Exploration Test Model 1;JIANLE CHEN;《Joint Video Exploration Team (JVET)》;全文 *
JVET-J0011:Description of SDR video coding technology proposal;WANG Z;《THE JOINT VIDEO EXPLORATION TEAM(JVET)》;全文 *
高效视频编码理论与算法研究;王建鹏;《中国博士学位论文全文数据库》;全文 *

Also Published As

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

Similar Documents

Publication Publication Date Title
CN109997361B (en) Low complexity symbol prediction for video coding
CN103748886B (en) Support the entropy code of pattern switching
CN111133759B (en) Method and apparatus for encoding or decoding video data
US10791341B2 (en) Binary arithmetic coding with progressive modification of adaptation parameters
US10554988B2 (en) Binary arithmetic coding with parameterized probability estimation finite state machines
CN109936742B (en) Method for encoding a video sequence, encoding device and storage medium
JP2006129467A (en) Lossless adaptive encoding/decoding of integer data
JP4547503B2 (en) Arithmetic coding apparatus, arithmetic coding method, arithmetic coding program, and computer-readable recording medium storing the program
TW201724852A (en) Parallel arithmetic coding techniques
CN110035288B (en) Method for encoding a video sequence, encoding device and storage medium
CN112073729B (en) Model updating method, device, electronic equipment and computer readable storage medium
KR101151352B1 (en) Context-based adaptive variable length coding decoder for h.264/avc
CN106063269B (en) Moving picture encoding device, dynamic image decoding device and moving picture encoding/coding/decoding method
JP2010004284A (en) Image decoder, and image decoding method
CN110545437B (en) Coefficient encoding method, coefficient decoding method, electronic device, and medium
CN112449186B (en) Encoding method, decoding method, corresponding devices, electronic equipment and storage medium
WO2020263438A1 (en) Features of range asymmetric number system encoding and decoding
US8675730B2 (en) Macroblock grouping in a destination video frame to improve video reconstruction performance
CN114079774B (en) Coding and decoding method and device for inter-frame prediction information
JP2008141382A (en) Coding device, method, and program
CN117119189A (en) Quantization and inverse quantization methods, devices and equipment applied to video coding and decoding
CN117097905A (en) Lossless image block compression method, lossless image block compression equipment and storage medium
CN114556430A (en) Data processing method and device, image signal processor and movable platform
CN113852811A (en) Inter-frame prediction rapid method and system based on CU correlation and storage medium
JP2018170673A (en) Image coding apparatus, image coding method, and 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
GR01 Patent grant
GR01 Patent grant