CN107682700B - Code adaptation method, device, mobile terminal and storage medium - Google Patents

Code adaptation method, device, mobile terminal and storage medium Download PDF

Info

Publication number
CN107682700B
CN107682700B CN201710940732.2A CN201710940732A CN107682700B CN 107682700 B CN107682700 B CN 107682700B CN 201710940732 A CN201710940732 A CN 201710940732A CN 107682700 B CN107682700 B CN 107682700B
Authority
CN
China
Prior art keywords
value
code rate
preset
code
coding
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
CN201710940732.2A
Other languages
Chinese (zh)
Other versions
CN107682700A (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.)
Jiangxi Oufijuneng Iot Technology Co ltd
Original Assignee
Jiangxi Oufijuneng Iot Technology 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 Jiangxi Oufijuneng Iot Technology Co ltd filed Critical Jiangxi Oufijuneng Iot Technology Co ltd
Priority to CN201710940732.2A priority Critical patent/CN107682700B/en
Publication of CN107682700A publication Critical patent/CN107682700A/en
Application granted granted Critical
Publication of CN107682700B publication Critical patent/CN107682700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
    • H04L1/0016Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy involving special memory structures, e.g. look-up tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Multimedia (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention provides a code adaptation method, a device, a mobile terminal and a storage medium, wherein the method comprises the following steps: inquiring a locally stored preset coding value range, acquiring any one coding rate value in the preset coding value range, and calculating the preset coding rate value range according to the coding rate value; controlling the equipment to be adapted to encode according to the encoding code rate value to obtain an output code rate value, and judging whether the output code rate value is within a preset code rate value range; if not, replacing the maximum value or the minimum value in the preset coding value range with a coding code rate value, returning to execute the step of obtaining any coding code rate value according to the replaced preset coding value range until the output code rate value is judged to be in the preset code rate value range, and setting the coding code rate value at the moment as the optimal code rate of the equipment to be adapted.

Description

Code adaptation method, device, mobile terminal and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a code adaptation method, apparatus, mobile terminal, and storage medium.
Background
With the development of the modern technology, the communication technology is also rapidly updated, especially the development of the coding technology is changing day by day, the coding technology is the process of converting information from one form or format to another form, and is also called code of computer programming language for short. Coding techniques are widely used in electronic computers, televisions, remote controls, and communications because coding techniques are used to encode characters, numbers, or other objects into numbers by a predetermined method, or to convert information or data into predetermined electrical pulse signals.
In the existing equipment with the coding function, due to different combinations of electronic components in different types of equipment, coding rate parameters set in different equipment and actually corresponding output coding rates have larger access, and further image data after coding output is easy to be unclear.
Disclosure of Invention
Based on this, an object of the embodiments of the present invention is to provide a code adaptation method, an apparatus, a mobile terminal, and a storage medium, which can perform optimal code rate setting for different models.
In a first aspect, the present invention provides a method for adapting coding, where the method includes:
inquiring a locally stored preset code value range, acquiring any code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value;
controlling the device to be adapted to encode according to the encoded code rate value to obtain an output code rate value, and judging whether the output code rate value is within the preset code rate value range;
if not, replacing the maximum value or the minimum value in the preset coding value range with the coding code rate value, returning to execute the step of obtaining any coding code rate value in the preset coding value range according to the replaced preset coding value range until the output code rate value is judged to be in the preset code rate value range, and setting the coding code rate value at the moment as the optimal code rate of the equipment to be adapted.
According to the code adaptation method, the device to be adapted is controlled to start an adaptation coding step by obtaining the code rate value, the output code rate value of the device to be adapted is obtained, whether the currently obtained code rate value is the optimal code rate corresponding to the device to be adapted is judged by judging whether the output code rate value is in the preset code rate value range, the accuracy of the code adaptation method is improved, the rate of obtaining the optimal code rate is improved by performing the replacement design of the code rate to the preset code rate value range, the step of obtaining any code rate value in the preset code rate range is performed by returning according to the replaced preset code rate value range, the obtaining of the code rate value is automatically returned continuously, whether the output code rate corresponding to the currently obtained code rate value is in the corresponding preset code rate value range is continuously judged, the automation degree of the code adaptation method is high, the obtaining of the optimal code rate is performed in a repeated cycle adaptation mode, the obtaining of the optimal code rate value can be effectively performed on the device to be adapted of different models, the output code rate value of the image data is further, and the output rate difference value of the image data is prevented from being larger output due to the unclear output parameter.
Further, the step of replacing the maximum value or the minimum value in the preset code value range with the code rate value includes:
judging whether the output code rate value is larger than the maximum value in the preset code rate value range or not;
if so, replacing the maximum value in the preset coding value range with the coding code rate value;
if not, replacing the minimum value in the preset code value range with the code rate value;
when the output code rate value is judged to be larger than the maximum value in the preset code rate value range, the set value of the coding code rate is judged to be larger, and then the maximum value in the preset coding value range is replaced by the coding code rate value, so that the obtaining range of the coding code rate is further reduced, and the adaptation accuracy of the coding adaptation method is improved.
Further, the step of replacing the maximum value or the minimum value in the preset code value range with the code rate value includes:
judging whether the output code rate value is smaller than the minimum value in the preset code rate value range or not;
if so, replacing the minimum value in the preset coding value range with the coding code rate value;
if not, replacing the maximum value in the preset coding value range with the coding code rate value;
when the output code rate value is smaller than the minimum value in the preset code rate value range, the set value of the coding code rate is judged to be smaller, and the minimum value in the preset coding value range is replaced by the coding code rate value, so that the obtaining range of the coding code rate is further reduced, and the adaptation accuracy of the coding adaptation method is improved.
Further, the step of obtaining any one of the encoding code rate values within the preset encoding value range includes:
respectively acquiring the maximum value and the minimum value of the preset coding value range;
calculating an average value of the sum of the maximum value and the minimum value of the preset coding value range, and setting the average value as the coding code rate value;
the average value is calculated by adopting an averaging mode, so that the setting of the code rate value is facilitated, and the obtaining efficiency of the code rate value is improved.
Further, before the step of determining whether the output code rate value is within a preset code rate value range, the method further includes:
judging whether the output code rate value is larger than the maximum value in the preset code value range or smaller than the minimum value in the preset code value range;
when the output code rate value is judged to be larger than the maximum value in the preset code value range, setting the maximum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step;
when the output code rate value is judged to be smaller than the minimum value in the preset code value range, setting the minimum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step;
when the output code rate value is judged to be larger than the maximum value in the preset code value range, the maximum value in the preset code value range is set to be the design of the optimal code rate, so that dead circulation caused by the fact that the output code rate value is always larger than the maximum value in the preset code value range is prevented, when the output code rate value is judged to be smaller than the minimum value in the preset code value range, the minimum value in the preset code value range is set to be the design of the optimal code rate, so that dead circulation caused by the fact that the output code rate value is always smaller than the minimum value in the preset code value range is prevented, and the adaptation efficiency of the code adaptation method is improved.
Further, the step of controlling the device to be adapted to encode according to the encoding code rate value includes:
initializing the equipment to be adapted, setting parameters of the equipment to be adapted according to the coding code rate, operating the equipment to be adapted, and controlling the equipment to be adapted to start a coding process to obtain a coding result;
calculating to obtain the output code rate value according to the coding result;
the method comprises the steps of initializing the equipment to be adapted, so as to prevent the equipment to be adapted from being influenced by other data, improve the accuracy of obtaining the adaptation result, and design the equipment to be adapted by setting parameters of the coding rate, so as to provide a normal coding rate parameter for the equipment to be adapted, thereby ensuring the normal operation of the coding function of the equipment to be adapted.
Further, the step of controlling the device to be adapted to start the encoding process includes:
acquiring preset code stream information;
generating YUV data with a preset frame number according to the acquired preset code stream information, and inputting the YUV data to the equipment to be adapted for coding;
the conversion of the YUV data is facilitated by acquiring the preset code stream information, and the design of converting the preset code stream information into the YUV data with the preset frame number is facilitated, so that the coding of the equipment to be adapted is facilitated, the coding efficiency of the equipment to be adapted is improved, and the adaptation efficiency of the coding adaptation method is further improved.
In a second aspect, the present invention provides a code adaptation apparatus, including:
the acquisition module is used for inquiring a locally stored preset code value range, acquiring any code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value;
the output judgment module is used for controlling the equipment to be adapted to encode according to the encoding code rate value to obtain an output code rate value and judging whether the output code rate value is within the range of the preset code rate value;
and the replacing module is used for replacing the maximum value or the minimum value in the preset code value range with the code rate value when the output judgment module judges that the output code rate value is not in the preset code value range, returning to execute the step of acquiring any code rate value in the preset code value range according to the replaced preset code value range, and setting the code rate value at the moment as the optimal code rate of the equipment to be adapted until the output code rate value is judged to be in the preset code rate value range.
The code adaptation device controls the device to be adapted to start an adaptation coding step through the design of the acquisition module and the output judgment module, obtains the output code rate value of the device to be adapted, judges whether the output code rate value is in the preset code rate value range through the design of the output judgment module, judges whether the currently acquired code rate value is the optimal code rate corresponding to the device to be adapted, improves the accuracy of the code adaptation method, improves the probability of acquiring the optimal code rate through the design of the replacement module, automatically returns to obtain any code rate value in the preset code value range according to the replaced preset code value range, continues to acquire the code rate value, continues to judge whether the output code rate corresponding to the currently acquired code rate value is in the corresponding preset code rate value range, has high automation degree, acquires the optimal code rate through a repeated cycle adaptation mode, so that the optimal code rate corresponding to different types of devices can be effectively acquired, and further prevents the output code rate of image data from being unclear due to the output code rate difference value of the set image data, and the output resolution of the image data is improved.
In a third aspect, the present invention provides a mobile terminal, including a memory for storing a computer program and a processor for executing the computer program to make the mobile terminal execute the code adaptation method described above.
In a fourth aspect, the present invention provides a storage medium having stored thereon a computer program for execution by a processor in the mobile terminal described above.
Drawings
Fig. 1 is a flowchart of a code adaptation method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a code adaptation method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an encoding adaptation apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an encoding adaptation apparatus according to a fourth embodiment of the present invention;
description of the symbols of the main elements
Figure BDA0001426607830000051
Figure BDA0001426607830000061
Detailed Description
In order to facilitate a better understanding of the invention, it will be further explained below in connection with the accompanying drawings of the related embodiments. Embodiments of the present invention are shown in the drawings, but the present invention is not limited to the preferred embodiments described above. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
The combination of each electronic component in different types of equipment with coding functions is different, so that the setting of coding parameters of different types of equipment is inconvenient, and when the error between the coding parameters set on the equipment and the actual output code rate is large, the image of an APP program in a system is easy to be unclear, for example, google adds an API (application programming interface) of system hard coding from the Android4.1 version, and the APP can be conveniently called to the interface, so that the CPU (Central processing Unit) occupancy rate is greatly reduced, and the coding performance is improved.
Referring to fig. 1, a flowchart of a code adaptation method according to a first embodiment of the present invention includes steps S10 to S50.
Step S10, inquiring a locally stored preset coding value range;
the method comprises the steps that a preset coding value range is inquired when a coding adaptation signal is received, the transmission mode of the coding adaptation signal can be in a key signal transmission mode, a voice signal transmission mode, an infrared signal transmission mode or a touch signal transmission mode, operation of a user is facilitated, the starting mode of the coding adaptation method is diversified, the preset coding value range can be any range, preferably, the maximum value in the preset coding value range is Bmax, the minimum value in the preset coding value range is Bmin, the preset coding value range is Bmin-Bmax, the number of the locally stored preset coding value ranges can be multiple, and the preset coding value range is used for facilitating first-time code rate setting of equipment to be adapted so as to guarantee normal starting of an adaptation step of the equipment to be adapted.
Step S20, acquiring any one code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value;
the method for acquiring any one of the code rate values in the preset code value range may be performed in a random extraction manner, a preset label manner, a sequential large-to-small acquisition manner, or a sequential small-to-large acquisition manner, and it is understood that the present embodiment is not limited to the above-described acquisition manner.
In this embodiment, the setting of the encoding parameters of the device to be adapted is facilitated by obtaining the encoding code rate, and the preset code rate value range is calculated according to the encoding code rate value by multiplying the obtained encoding code rate value by 0.9 times to obtain a first encoding code rate threshold value, multiplying the obtained encoding code rate value by 1.1 times to obtain a second encoding code rate threshold value, setting the first encoding code rate threshold value as the minimum value in the preset code rate value range, and setting the second encoding code rate threshold value as the maximum value in the preset code rate value range to obtain the preset code rate value range;
in this embodiment, the obtained code rate value is Z, and at this time, the preset code value range is 0.9Z to 1.1Z.
Step S30, controlling the device to be adapted to encode according to the encoding code rate value to obtain an output code rate value, and judging whether the output code rate value is within the range of the preset code rate value;
when the coding rate is obtained and the preset coding value range is obtained through calculation, sending a signal to the device to be adapted to control the start of a coding test of the device to be adapted, and when the device to be adapted finishes the coding test, obtaining the output code rate value and judging whether the output code rate value is in the preset code rate value range or not to judge whether the coding rate set for the device to be adapted at the moment is the optimal code rate or not;
in this embodiment, the output code rate value is set to Y, that is, it is determined whether Y is in the range of 0.9Z to 1.1Z.
When the step S30 determines that the output code rate value is not within the preset code rate value range, step S40 is executed;
when Y is judged not to be in the range of 0.9Z to 1.1Z, Y is judged not to be the optimal code rate of the device to be adapted.
And S40, replacing the maximum value or the minimum value in the preset code value range with the code rate value, and returning to execute the step S20.
And returning to execute the step of acquiring any code rate value in the preset code value range according to the replaced preset code value range, namely when Y is judged not to be in the range of 0.9Z to 1.1Z, replacing 0.9Z or 1.1Z in the preset code value range with Z to obtain a new preset code value range, wherein the replaced preset code value range is smaller than the preset code value range before replacement, and the effect of reducing the range is achieved.
In this embodiment, after a new preset code value range is obtained by replacement, return to perform acquisition of any code rate value, and sequentially and cyclically calculate the preset code rate value range, and perform judgment on the output code rate value output after performing encoding parameters of the device to be adapted again and the preset code rate value range, it can be understood that, when the code rate value is obtained again, the preset code value range changes with changes of different code rate values, but a multiple relationship between a maximum value and a minimum value in the preset code value range and the code rate value obtained at that time does not change, that is, multiple relationships between the maximum value and the minimum value in the preset code value range and the code rate value obtained at that time are respectively 1.1 times and 0.9 times, which can be understood, in other embodiments, the multiple relationship between the maximum value in the preset code value range and the code rate value obtained at that time may also be other multiple relationships, but the multiple relationship may not change in the same embodiment.
In this embodiment, the step S40 is not stopped until the step S30 determines that the output code rate value is within the preset code rate value range, so that the code rate parameters of the device to be adapted are adapted and set repeatedly until the optimal code rate is obtained, and the effect of adapting and setting the optimal code rate can be achieved for the devices to be adapted of different models, so that the code adaptation method has a wide application range and high versatility.
And when the output code rate value is determined to be within the preset code rate value range in the step S30, performing step S50.
And S50, setting the coding rate value at the moment as the optimal code rate of the equipment to be adapted.
When the step 30 or the step S40 returns to the step S20 to the step S30, and it is determined that the output code rate value is within the preset code rate value range, setting the coding code rate value at this time as the optimal code rate of the device to be adapted;
specifically, Z set for the device to be adapted at this time is set as the optimal code rate.
In this embodiment, the acquisition of the code rate value is performed to control the device to be adapted to start an adaptation coding step, and obtain the output code rate value of the device to be adapted, the design of judging whether the output code rate value is within the preset code rate value range is performed to judge whether the currently acquired code rate value is the optimal code rate corresponding to the device to be adapted, so as to improve the accuracy of the code adaptation method, the replacement design of the code rate to the preset code value range is performed to improve the probability of acquiring the optimal code rate, the design of performing the step of acquiring any code rate value within the preset code value range is returned according to the replaced preset code value range, so as to automatically return to continue the acquisition of the code rate value, and continuously judge whether the output code rate value corresponding to the currently acquired code rate value is within the corresponding preset code rate value range, the coding adaptation method has a high automation degree, the acquisition of the optimal code rate is performed in a repeated cyclic adaptation manner, so as to effectively perform the acquisition of the optimal code rate corresponding to the device to be adapted to different models, thereby preventing the increase of the output image data clarity caused by the set code rate value and the output image data.
Referring to fig. 2, a flowchart of a coding adaptation method according to a second embodiment of the present invention is shown, where the method includes steps S11 to S101.
S11, inquiring a locally stored preset code value range;
the preset code value range is inquired only when the code adaptation signal is received, the transmission mode of the code adaptation signal can be key signal transmission, voice signal transmission, infrared signal transmission or touch signal transmission and the like, operation of a user is facilitated, the starting mode of the code adaptation method is diversified, the preset code value range can be any range, and preferably, in the embodiment, the maximum value in the preset code value range is Bmax, the minimum value is Bmin, the preset code value range is Bmin-Bmax, the number of the locally stored preset code value ranges can be multiple, and the preset code value range is used for facilitating first-time code rate setting of the device to be adapted so as to guarantee normal starting of the adaptation step of the device to be adapted.
Step S21, respectively obtaining the maximum value and the minimum value of the preset coding value range;
step S31, calculating an average value of the sum of the maximum value and the minimum value of the preset code value range, setting the average value as a code rate value, and calculating a preset code rate value range according to the code rate value;
preferably, in this embodiment, the method of obtaining the code rate value is performed by averaging, so as to facilitate setting of the code rate value, and further improve the obtaining efficiency of the code rate value, that is, Z = (Bmin + Bmax)/2, and this embodiment is not limited to the above obtaining method;
in this embodiment, the setting of the encoding parameters of the device to be adapted is facilitated by obtaining the encoding code rate, and the preset code rate value range is calculated according to the encoding code rate value by multiplying the obtained encoding code rate value by 0.9 time to obtain a first encoding code rate threshold, multiplying the obtained encoding code rate value by 1.1 time to obtain a second encoding code rate threshold, setting the first encoding code rate threshold as the minimum value in the preset code rate value range, and setting the second encoding code rate threshold as the maximum value in the preset code rate value range to obtain the preset code rate value range, that is, the preset code rate value range is 0.9Z to 1.1Z.
Step S41, initializing the equipment to be adapted, setting parameters of the equipment to be adapted according to the coding code rate, and operating the equipment to be adapted;
the method comprises the steps of initializing the equipment to be adapted, designing a code rate setting module to set the code rate of the equipment to be adapted, and setting the code rate of the equipment to be adapted according to the code rate setting module.
Step S51, acquiring preset code stream information, generating YUV data with a preset frame number according to the acquired preset code stream information, and inputting the YUV data into the device to be adapted for encoding;
the conversion of the YUV data is facilitated by acquiring the preset code stream information, and the design of converting the preset code stream information into the YUV data with the preset frame number is facilitated, so that the coding of the equipment to be adapted is facilitated, the coding efficiency of the equipment to be adapted is improved, and the adaptation efficiency of the coding adaptation method is further improved.
Specifically, when the YUV data is input to the device to be adapted for encoding, and the encoding result is obtained, the output code rate value may be calculated according to the encoding result.
In this embodiment, the distance procedure of coding in the to-be-adapted setting is as follows:
(1) Initializing an encoder, and setting encoding parameters such as the width, the height and the code rate of a video, wherein the code rate parameter is set as the encoding code rate value acquired at the moment;
(2) Generating 2000 frames of YUV data by using a mathematical function;
(3) Inputting the YUV data into an encoder for encoding;
(4) And calculating an actual code rate according to the output code stream, wherein the actual code rate is the output code rate.
Step S61, judging whether the output code rate value is in a preset code rate value range;
wherein, the output code rate value is set as Y, namely, whether Y is in the range of 0.9Z to 1.1Z is judged.
And executing step S71 when the output code rate value is not within the preset code rate value range according to the determination of step S61.
Step S71, judging whether the output code rate value is larger than 1.1 times of the code rate value;
wherein, whether Y is larger than 1.1Z is judged.
When the step S71 determines that the output code rate value is greater than 1.1 times the encoding code rate value, step S81 is executed.
And S81, replacing the maximum value in the preset code value range with the code rate value, and returning to execute the step S21 according to the replaced preset code value range.
When the output code rate value is larger than the maximum value in the preset code rate value range, the set value of the coding code rate is judged to be larger, and then the maximum value in the preset coding value range is replaced by the coding code rate value, namely, the current Z is replaced by 1.1Z, so that the obtaining range of the coding code rate is further narrowed, and the adaptation accuracy of the coding adaptation method is improved, for example, when the coding code rate value is 4, the preset coding value range is 3.6 to 4.4, the maximum value 4.4 in the preset code rate value range is replaced, so that the replaced preset coding value range is 3.6 to 4, and the step S21 is returned to be executed according to the replaced preset coding value range.
When it is determined in step S71 that the output bitrate value is not greater than 1.1 times the encoding bitrate value, it is determined that the output bitrate value is less than 0.9 times the encoding bitrate value, and step S91 is performed.
And S91, replacing the minimum value in the preset code value range with the code rate value, and returning to execute the step S21 according to the replaced preset code value range.
When the output code rate value is smaller than the minimum value in the preset code rate value range, the set value of the coding code rate is judged to be smaller, and then the minimum value in the preset coding value range is replaced by the coding code rate value, namely, the current Z is replaced by 0.9Z, so that the obtaining range of the coding code rate is further narrowed, and the adaptation precision of the coding adaptation method is improved, for example, when the coding code rate value is 4, the preset coding value range is 3.6 to 4.4, the minimum value in the preset code rate value range is 3.6 to 4.4, so that the replaced preset coding value range is 4 to 4.4, and the step S21 is returned according to the replaced preset coding value range.
Wherein, the step S71 may further be: judging whether the output code rate value is less than 0.9 times of the code rate value;
when the output code rate value is judged to be smaller than the coding code rate value which is 0.9 times, the step S81 is: and replacing the minimum value in the preset coding value range with the coding rate value, and returning to execute the step S21 according to the replaced preset coding value range.
When it is determined that the output code rate value is not less than 0.9 times the encoding code rate value, step S91 is: and replacing the maximum value in the preset coding value range with the coding rate value, and returning to execute the step S21 according to the replaced preset coding value range.
And judging whether the current coding rate is the optimal coding rate in a diversified manner by judging whether the output code rate value is less than 0.9 times of the coding rate value or more than 1.1 times of the coding rate value.
And when the output code rate value is within the preset code rate value range according to the judgment of the step S61, executing a step S101.
Step S101, setting the code rate value at the moment as the optimal code rate of the device to be adapted.
When the step 61, the step S81, the step S21 to the step S61, or the step S91, the step S21 to the step S61 is performed, and it is determined that the output bitrate value is within the preset bitrate value range, the coding bitrate value at this time is set as the optimal bitrate of the device to be adapted;
specifically, Z set for the device to be adapted at this time is set as the optimal code rate.
Before the step of determining whether the output code rate value is within the preset code rate value range in the step S61, the method further includes:
judging whether the output code rate value is larger than the maximum value in the preset code value range or smaller than the minimum value in the preset code value range;
when the output code rate value is judged to be larger than the maximum value in the preset code value range, setting the maximum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step;
and when the output code rate value is judged to be smaller than the minimum value in the preset code value range, setting the minimum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step.
And when the output code rate value is judged to be smaller than the minimum value in the preset code value range, setting the minimum value in the preset code value range as the design of the optimal code rate to prevent the dead cycle caused by the fact that the output code rate value is always larger than the maximum value in the preset code value range, and when the output code rate value is judged to be smaller than the minimum value in the preset code value range, setting the minimum value in the preset code value range as the design of the optimal code rate to prevent the dead cycle caused by the fact that the output code rate value is always smaller than the minimum value in the preset code value range, thereby improving the adaptation efficiency of the code adaptation method.
In this embodiment, the acquisition of the code rate value is performed to control the device to be adapted to start an adaptation coding step, and obtain the output code rate value of the device to be adapted, the design of judging whether the output code rate value is within the preset code rate value range is performed to judge whether the currently acquired code rate value is the optimal code rate corresponding to the device to be adapted, so as to improve the accuracy of the code adaptation method, the replacement design of the code rate to the preset code value range is performed to improve the probability of acquiring the optimal code rate, the design of performing the step of acquiring any code rate value within the preset code value range is returned according to the replaced preset code value range, so as to automatically return to continue the acquisition of the code rate value, and continuously judge whether the output code rate value corresponding to the currently acquired code rate value is within the corresponding preset code rate value range, the coding adaptation method has a high automation degree, the acquisition of the optimal code rate is performed in a repeated cyclic adaptation manner, so as to effectively perform the acquisition of the optimal code rate corresponding to the device to be adapted to different models, thereby preventing the increase of the output image data clarity caused by the set code rate value and the output image data.
Referring to fig. 3, a schematic structural diagram of an adaptive encoding device 100 according to a third embodiment of the present invention includes:
the acquisition module 10 is configured to query a locally stored preset code value range, acquire any one code rate value within the preset code value range, and calculate a preset code rate value range according to the code rate value;
the output judgment module 20 is configured to control the device to be adapted to perform encoding according to the encoding code rate value to obtain an output code rate value, and judge whether the output code rate value is within the preset code rate value range;
a replacing module 30, configured to replace the maximum value or the minimum value in the preset code value range with the code rate value when the output determining module 20 determines that the output code rate value is not within the preset code value range, and return to execute the step of obtaining any code rate value in the preset code value range according to the replaced preset code value range until it is determined that the output code rate value is within the preset code value range, and set the code rate value at this time as the optimal code rate of the device to be adapted.
The replacement module 30 includes:
the first sub-replacement module 31 is configured to determine whether the output code rate value is greater than a maximum value in the preset code rate value range, if so, replace the maximum value in the preset code rate value range with the code rate value, and if not, replace the minimum value in the preset code rate value range with the code rate value.
A second sub-replacement module 32, configured to determine whether the output code rate value is smaller than the minimum value in the preset code rate value range, if yes, replace the minimum value in the preset code rate value range with the code rate value, and if not, replace the maximum value in the preset code rate value range with the code rate value.
The acquisition module 10 includes:
a sub-obtaining module 11, configured to obtain a maximum value and a minimum value of the preset encoding value range respectively;
a first calculating module 12, configured to calculate an average value of a sum of a maximum value and a minimum value of the preset code value range according to the obtaining result of the sub-obtaining module 10, set the average value as the code rate value, and calculate a preset code rate value range according to the code rate value.
The output judgment module 20 includes:
the encoding module 21 is configured to initialize the device to be adapted, perform parameter setting on the device to be adapted with the encoding code rate, operate the device to be adapted, and control the device to be adapted to start an encoding process to obtain an encoding result.
A second calculating module 22, configured to calculate the output code rate value according to the encoding result obtained by the encoding module 21.
The encoding module 21 includes:
the code stream transmission module 211 is configured to acquire preset code stream information, generate YUV data with a preset frame number according to the acquired preset code stream information, and input the YUV data to the device to be adapted for encoding.
The code adaptation device 100 controls the device to be adapted to start an adaptation coding step through the design of the obtaining module 10 and the output judging module 20, obtains the output code rate value of the device to be adapted, judges whether the output code rate value is in the preset code rate value range through the design of the output judging module 20, judges whether the currently obtained code rate value is the optimal code rate corresponding to the device to be adapted, and improves the accuracy of the code adaptation method, improves the probability of obtaining the optimal code rate through the design of the replacing module 30, returns the design of executing the step of obtaining any code rate value in the preset code value range according to the replaced preset code value range to automatically return to continue obtaining the code rate value, and continues to judge whether the output code rate value corresponding to the currently obtained code rate value is in the corresponding preset code rate value range, has a high automation degree, obtains the optimal code rate through a repeated cyclic adaptation mode, so that the optimal code rate can be effectively obtained for different types of devices, and further improves the output definition of image data due to the output resolution of the image data.
Referring to fig. 4, a schematic structural diagram of an adaptive encoding device 100 according to a fourth embodiment of the present invention is shown, where the fourth embodiment has a structure that is substantially the same as that of the third embodiment, and the difference is that the adaptive encoding device 100 in this embodiment further includes:
and a threshold judgment module 40, configured to judge whether the output code rate value is greater than a maximum value in the preset code value range or smaller than a minimum value in the preset code value range.
A first setting module 41, configured to set the maximum value in the preset code value range as the optimal code rate of the device to be adapted, and stop the code adaptation step, when the threshold determination module 40 determines that the output code rate value is greater than the maximum value in the preset code value range.
A second setting module 42, configured to set the minimum value in the preset code value range as the optimal code rate of the device to be adapted when the threshold determination module 40 determines that the output code rate value is smaller than the minimum value in the preset code value range, and stop the code adaptation step.
In this embodiment, through the design of determining the maximum value or the minimum value of the output code rate value and the preset code value range in the threshold determination module 40, when it is determined that the output code rate value is greater than the maximum value of the preset code value range, the maximum value of the preset code value range is set as the design of the optimal code rate, so as to prevent dead loop caused by that the output code rate value is always greater than the maximum value of the preset code value range, and when it is determined that the output code rate value is smaller than the minimum value of the preset code value range, the minimum value of the preset code value range is set as the design of the optimal code rate, so as to prevent dead loop caused by that the output code rate value is always smaller than the minimum value of the preset code value range, thereby improving the adaptation efficiency of the code adaptation device 100.
The embodiment also provides a mobile terminal, which includes a memory and a processor, where the memory is used for storing a computer program, and the processor runs the computer program to make the mobile terminal execute the above code adaptation method.
The embodiment also provides a storage medium, on which a computer program run by a processor in the mobile terminal is stored, and when executed, the program includes the following steps:
inquiring a locally stored preset code value range, acquiring any code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value;
controlling the equipment to be adapted to encode according to the encoding code rate value to obtain an output code rate value, and judging whether the output code rate value is within the range of the preset code rate value;
if not, replacing the maximum value or the minimum value in the preset coding value range with the coding code rate value, returning to execute the step of obtaining any coding code rate value in the preset coding value range according to the replaced preset coding value range until the output code rate value is judged to be in the preset code rate value range, and setting the coding code rate value at the moment as the optimal code rate of the equipment to be adapted. The storage medium, such as: ROM/RAM, magnetic disks, optical disks, etc.
The above-described embodiments describe the technical principles of the present invention, and these descriptions are only for the purpose of explaining the principles of the present invention and are not to be construed as limiting the scope of the present invention in any way. Based on the explanations herein, those skilled in the art will be able to conceive of other embodiments of the present invention without inventive step, and these embodiments will fall within the scope of the present invention.

Claims (10)

1. A method of code adaptation, the method comprising:
inquiring a locally stored preset code value range, acquiring any code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value; the preset coding value range is used for facilitating the first code rate setting of the equipment to be adapted so as to ensure the normal starting of the adaptation step of the equipment to be adapted;
controlling the equipment to be adapted to encode according to the encoding code rate value to obtain an output code rate value, and judging whether the output code rate value is within the range of the preset code rate value;
if not, replacing the maximum value or the minimum value in the preset coding value range with the coding code rate value, returning to execute the step of obtaining any coding code rate value in the preset coding value range according to the replaced preset coding value range until the output code rate value is judged to be in the preset code rate value range, and setting the coding code rate value at the moment as the optimal code rate of the equipment to be adapted.
2. The code adaptation method according to claim 1, wherein the step of replacing the maximum value or the minimum value within the preset code value range with the code rate value comprises:
judging whether the output code rate value is larger than the maximum value in the preset code rate value range or not;
if so, replacing the maximum value in the preset coding value range with the coding code rate value;
and if not, replacing the minimum value in the preset code value range with the code rate value.
3. The code adaptation method according to claim 1, wherein the step of replacing the maximum value or the minimum value within the preset coding value range with the coding rate value comprises:
judging whether the output code rate value is smaller than the minimum value in the preset code rate value range or not;
if so, replacing the minimum value in the preset coding value range with the coding code rate value;
and if not, replacing the maximum value in the preset coding value range with the coding rate value.
4. The code adaptation method according to claim 1, wherein the step of obtaining any one of the code rate values in the preset code value range comprises:
respectively acquiring the maximum value and the minimum value of the preset coding value range;
and calculating the average value of the sum of the maximum value and the minimum value of the preset coding value range, and setting the average value as the coding code rate value.
5. The code adaptation method of claim 1, wherein the step of determining whether the output code rate value is within a predetermined range of code rate values is preceded by the step of:
judging whether the output code rate value is larger than the maximum value in the preset code value range or smaller than the minimum value in the preset code value range;
when the output code rate value is judged to be larger than the maximum value in the preset code value range, setting the maximum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step;
and when the output code rate value is judged to be smaller than the minimum value in the preset code value range, setting the minimum value in the preset code value range as the optimal code rate of the equipment to be adapted, and stopping the code adaptation step.
6. The code adaptation method according to claim 1, wherein the step of controlling the device to be adapted to perform coding according to the code rate value comprises:
initializing the equipment to be adapted, setting parameters of the equipment to be adapted according to the coding code rate, operating the equipment to be adapted, and controlling the equipment to be adapted to start a coding process to obtain a coding result;
and calculating to obtain the output code rate value according to the coding result.
7. The code adaptation method according to claim 6, wherein the step of controlling the device to be adapted to start the coding process comprises:
acquiring preset code stream information;
and generating YUV data with a preset frame number according to the acquired preset code stream information, and inputting the YUV data to the equipment to be adapted for coding.
8. An encoding adaptation apparatus, comprising:
the acquisition module is used for inquiring a locally stored preset code value range, acquiring any code rate value in the preset code value range, and calculating the preset code rate value range according to the code rate value; the preset coding value range is used for facilitating the first code rate setting of the equipment to be adapted so as to ensure the normal starting of the adaptation step of the equipment to be adapted;
the output judgment module is used for controlling the equipment to be adapted to encode according to the encoding code rate value to obtain an output code rate value and judging whether the output code rate value is within the range of the preset code rate value;
and the replacing module is used for replacing the maximum value or the minimum value in the preset code value range with the code rate value when the output judgment module judges that the output code rate value is not in the preset code value range, returning to execute the step of acquiring any code rate value in the preset code value range according to the replaced preset code value range, and setting the code rate value at the moment as the optimal code rate of the equipment to be adapted until the output code rate value is judged to be in the preset code rate value range.
9. A mobile terminal, characterized in that it comprises a memory for storing a computer program and a processor running the computer program to cause the mobile terminal to perform the code adaptation method according to any of claims 1 to 7.
10. A storage medium, characterized in that it stores a computer program run by a processor in a mobile terminal according to claim 9.
CN201710940732.2A 2017-09-30 2017-09-30 Code adaptation method, device, mobile terminal and storage medium Active CN107682700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710940732.2A CN107682700B (en) 2017-09-30 2017-09-30 Code adaptation method, device, mobile terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710940732.2A CN107682700B (en) 2017-09-30 2017-09-30 Code adaptation method, device, mobile terminal and storage medium

Publications (2)

Publication Number Publication Date
CN107682700A CN107682700A (en) 2018-02-09
CN107682700B true CN107682700B (en) 2022-10-21

Family

ID=61139405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710940732.2A Active CN107682700B (en) 2017-09-30 2017-09-30 Code adaptation method, device, mobile terminal and storage medium

Country Status (1)

Country Link
CN (1) CN107682700B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104159109A (en) * 2014-05-28 2014-11-19 百视通网络电视技术发展有限责任公司 Bit rate control method and system based on VBR video encoding
CN106231306A (en) * 2015-06-02 2016-12-14 韩华泰科株式会社 Use the imaging device of MJPEG compression method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
BRPI0911762A2 (en) * 2008-06-05 2016-08-02 Nippon Telegraph & Telephone video bitrate control method, video bitrate control apparatus, video bitrate control program, and computer readable recording medium having the program recorded therein
CN101803383A (en) * 2008-07-17 2010-08-11 松下电器产业株式会社 Transmission device, reception device, rate control device, transmission method, and reception method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104159109A (en) * 2014-05-28 2014-11-19 百视通网络电视技术发展有限责任公司 Bit rate control method and system based on VBR video encoding
CN106231306A (en) * 2015-06-02 2016-12-14 韩华泰科株式会社 Use the imaging device of MJPEG compression method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Optimal rate and input format control for content and context adaptive video streaming;T.Ozcelebi等;《Proceedings of the IEEE 12th Signal Processing and Communications Applications Conference, 2004.》;20041025;全文 *
移动流媒体动态码率适配机制研究;施文灿;《2007年中国通信学会"移动增值业务与应用"学术年会论文集》;20070930;全文 *

Also Published As

Publication number Publication date
CN107682700A (en) 2018-02-09

Similar Documents

Publication Publication Date Title
US10390040B2 (en) Method, apparatus, and system for deep feature coding and decoding
RU2014123342A (en) METHOD FOR CODING AND DECODING IMAGES, DEVICE FOR CODING AND DECODING, AND RELATED COMPUTER PROGRAMS
KR20220001420A (en) Method for coding video and related device
US11197021B2 (en) Coding resolution control method and terminal
US11054947B2 (en) Key reference updating method and module, and terminal device
CN108235075B (en) Video quality grade matching method, computer readable storage medium and terminal
CN112422963B (en) Cloud computer system, encoding method, encoding device, cloud computer equipment and storage medium
CN113382258B (en) Video encoding method, apparatus, device, and medium
CN110688098A (en) Method and device for generating system framework code, electronic equipment and storage medium
CN107682700B (en) Code adaptation method, device, mobile terminal and storage medium
WO2024051757A1 (en) Information processing method and apparatus, electronic device and computer readable medium
CN114564345A (en) Server abnormity detection method, device, equipment and storage medium
CN109219960B (en) Method, device and equipment for optimizing video coding quality smoothness and storage medium
CN108683915B (en) Method and device for writing dQP value and electronic equipment
CN110992387A (en) Image processing method and device, electronic equipment and storage medium
CN116527652A (en) Method, device, equipment and medium for determining file format conversion path
CN107729136B (en) Processing priority configuration method and device based on FPGA
CN115633191A (en) Video playing method, device, system, electronic equipment and readable storage medium
CN106937168B (en) Video coding method, electronic equipment and system using long-term reference frame
CN111510715B (en) Video processing method, system, computer device and storage medium
GB2600796A (en) Method and apparatus for coding video, device and medium
CN111836051A (en) Desktop image coding and decoding methods and related devices
CN113271462B (en) Method and device for evaluating video coding algorithm, computer equipment and medium
CN113099216B (en) Coding complexity evaluation method, device, equipment and storage medium
CN114501026B (en) Video coding method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB02 Change of applicant information

Address after: 518000 Guangdong city of Shenzhen province Nanshan District Guangdong streets Changhong technology science and technology twelve South Road, building 19 floor

Applicant after: Shenzhen Oufei New Technology Co.,Ltd.

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Guangdong streets Changhong technology science and technology twelve South Road, building 19 floor

Applicant before: SHENZHEN TEMOBI INNOVATION TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
TA01 Transfer of patent application right

Effective date of registration: 20200429

Address after: 335000 No.7 road-0006, high tech Industrial Development Zone, Yingtan City, Jiangxi Province

Applicant after: Jiangxi oufijuneng IOT Technology Co.,Ltd.

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Guangdong streets Changhong technology science and technology twelve South Road, building 19 floor

Applicant before: Shenzhen Oufei New Technology Co.,Ltd.

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant