CN111385563B - Hardware encoder detection method and device and terminal - Google Patents

Hardware encoder detection method and device and terminal Download PDF

Info

Publication number
CN111385563B
CN111385563B CN201811638773.7A CN201811638773A CN111385563B CN 111385563 B CN111385563 B CN 111385563B CN 201811638773 A CN201811638773 A CN 201811638773A CN 111385563 B CN111385563 B CN 111385563B
Authority
CN
China
Prior art keywords
hardware encoder
output
encoder
value
test
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
CN201811638773.7A
Other languages
Chinese (zh)
Other versions
CN111385563A (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.)
Bigo Technology Singapore Pte Ltd
Original Assignee
Guangzhou Baiguoyuan Information 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 Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN201811638773.7A priority Critical patent/CN111385563B/en
Publication of CN111385563A publication Critical patent/CN111385563A/en
Application granted granted Critical
Publication of CN111385563B publication Critical patent/CN111385563B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N17/00Diagnosis, testing or measuring for television systems or their details
    • 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

Abstract

The invention provides a hardware encoder detection method, a device, a terminal, computer equipment and a storage medium, wherein the method inputs a test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters; acquiring output data of a hardware encoder, and calculating test performance parameters of the hardware encoder according to the output data; and comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder, wherein the parameter reference value is set according to a preset encoding parameter. Because the hardware encoder in the unavailable state can influence the quality and the efficiency of video transmission and playing, the hardware encoder in the unavailable state can waste manpower and material resources, and the efficiency is low. According to the hardware encoder detection method, the reliability of the hardware encoder can be improved through the hardware encoder which detects the available state, so that the quality and efficiency of video transmission and playing are improved subsequently, and the cost of manpower and material resources is reduced.

Description

Hardware encoder detection method and device and terminal
Technical Field
The invention relates to the technical field of video coding processing, in particular to a hardware encoder detection method, a hardware encoder detection device, a terminal, computer equipment and a storage medium.
Background
With the wide application of video conferences, social instant messaging software and live video, the communication of the public is facilitated, and the requirement on video definition is higher and higher.
Maintaining a certain definition after video transmission needs to be achieved by means of video encoding and decoding. At present, a hardware encoder is generally used for encoding video on a mobile terminal, and due to the fact that manufacturers of the mobile terminal are numerous and various hardware encoder versions exist, the quality of the hardware encoder is uneven.
When the quality of the video after encoding and decoding is reduced, the usability cannot be determined due to the poor quality of the hardware encoder, that is, the low reliability of the hardware encoder.
Disclosure of Invention
The object of the present invention is to solve at least one of the above-mentioned technical drawbacks, in particular the low reliability of the hardware encoder.
The invention provides a hardware encoder detection method, which comprises the following steps:
inputting a test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters;
acquiring output data of the hardware encoder, and calculating test performance parameters of the hardware encoder according to the output data;
and comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder, wherein the parameter reference value is set according to the preset encoding parameter.
In one embodiment, the preset encoding parameters include: testing code rate, testing resolution, testing frame rate and testing code stream;
before the step of inputting the test sequence into the hardware encoder for testing, the method further comprises:
and establishing the hardware encoder according to the test code rate, the test resolution, the test frame rate and the test code stream.
In one embodiment, the output data comprises output encoded data, the test performance parameter comprises a code rate deviation value, and the parameter reference value comprises a code rate deviation tolerance value;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
acquiring output coded data of the hardware encoder, and calculating a code rate deviation value between the output code rate of the hardware encoder and the expected output code rate according to the output coded data;
the step of comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder includes:
and comparing the code rate deviation value with the code rate deviation tolerance value, and judging that the state of the hardware encoder is an available state when the code rate deviation value is greater than the code rate deviation tolerance value.
In one embodiment, the outputting the encoded data includes an encoded frame, and the calculating a code rate deviation value between an output code rate of the hardware encoder and an expected output code rate according to the outputting the encoded data includes:
when the hardware encoder outputs any encoding frame, counting the output value of the encoder, and accumulating the total output data volume output by the hardware encoder according to the data volume of the encoding frame;
and calculating the code rate deviation value according to the counted encoder output value and the accumulated total output data.
In one embodiment, the step of calculating the code rate offset value according to the counted encoder output values and the accumulated total output data amount includes:
acquiring the output code rate of the hardware encoder and the test frame rate;
calculating expected output data volume according to the counted encoder output value, the output code rate and the test frame rate;
and calculating the code rate deviation value according to the accumulated total output data quantity and the expected output data quantity.
In one embodiment, the step of calculating the expected output data amount according to the counted encoder output value, the output code rate and the test frame rate includes the following formula:
EP=EncOut×EncBitrate/TEST_FPS
wherein EP is the expected output data amount, EncOut is the counted encoder output value, EncBitrate is the output code rate, and TEST _ FPS is the TEST frame rate;
the step of calculating the code rate deviation value according to the accumulated total output data volume and the expected output data volume comprises the following formula:
bitrateOffset=abs(BITALL-EP)×100%/EP
wherein bitrate offset is the code rate deviation value, bitlal is the total output data amount after accumulation, EP is the expected output data amount, and abs (·) is an absolute value taking function.
In one embodiment, the output data comprises output encoded data, the test performance parameter comprises an average peak signal-to-noise ratio, and the parameter reference value comprises a signal-to-noise ratio threshold;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
acquiring output coded data of the hardware encoder, wherein the average peak signal-to-noise ratio of the decoded output coded data is acquired;
the step of comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder includes:
and comparing the average peak signal-to-noise ratio with the signal-to-noise ratio threshold, and judging the state of the hardware encoder to be an available state when the peak signal-to-noise ratio is smaller than the signal-to-noise ratio threshold.
In one embodiment, the outputting encoded data includes an encoded frame, and the obtaining the average peak snr of the decoded output encoded data includes:
acquiring a coded frame output by the hardware encoder;
inputting the coding frame into a decoder for decoding to obtain a decoding frame of the coding frame;
calculating a peak signal-to-noise ratio of the decoded frame;
and accumulating the peak signal-to-noise ratio total value according to the peak signal-to-noise ratio of the decoded frame, and calculating the average peak signal-to-noise ratio of the hardware encoder according to the accumulated peak signal-to-noise ratio total value.
In one embodiment, the decoder is a software decoder corresponding to the hardware encoder, and before the step of inputting the encoded frame into the decoder for decoding, the method further includes:
and creating the software decoder according to the test code rate, the test resolution, the test frame rate and the test code stream of the hardware encoder.
In one embodiment, the output data comprises encoded frames, the test performance parameter comprises a delay time, and the parameter reference value comprises a delay tolerant value;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
counting the number of delay output frames of the hardware encoder;
calculating the delay time according to the delay output frame number and the test frame rate;
the step of determining the available state of the hardware encoder according to the comparison result between the set parameter reference value and the performance parameter includes:
and comparing the delay time with the delay tolerance value, and judging that the state of the hardware encoder is an available state when the delay time is greater than the delay tolerance value.
In one embodiment, the step of counting the number of frames of the delayed output of the hardware encoder includes:
counting encoder input values when any one test sequence is input into the hardware encoder;
counting an encoder output value when the hardware encoder outputs any one of the encoded frames;
and taking the difference value of the counted encoder input value and the counted encoder output value as the delay output frame number.
In one embodiment, after the step of determining the available state of the hardware encoder, the method further includes:
acquiring output data output by the hardware encoder next time;
and executing the step of calculating the test performance parameters of the hardware encoder according to the output data.
The present invention also provides a hardware encoder detection apparatus, including:
the test sequence input module is used for inputting a test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters;
the performance calculation module is used for acquiring output data of the hardware encoder and calculating test performance parameters of the hardware encoder according to the output data;
and the state judgment module is used for comparing the performance parameter with a set parameter reference value and determining the available state of the hardware encoder, wherein the parameter reference value is set according to the preset encoding parameter.
The present invention also provides a terminal, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the hardware encoder detection method of any embodiment.
The invention also provides a computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of detecting by a hardware encoder as described in any of the embodiments.
The present invention also provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the hardware encoder detection method of any of the embodiments.
According to the hardware encoder detection method, the hardware encoder detection device, the hardware encoder, the terminal, the computer equipment and the storage medium, the reliability of the hardware encoder can be improved by detecting the hardware encoder in the available state, so that the quality and the efficiency of video transmission and playing can be improved subsequently, and the cost of manpower and material resources is reduced.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a diagram of an implementation environment of a hardware encoder detection method provided in one embodiment;
FIG. 2 is a flow diagram of a hardware encoder detection method of an embodiment;
FIG. 3 is a flow chart of a hardware encoder detection method in another embodiment;
FIG. 4 is a diagram illustrating an exemplary hardware encoder detection device;
FIG. 5 is a diagram illustrating the structure of a terminal in one embodiment;
FIG. 6 is a diagram showing an internal configuration of a computer device according to an embodiment.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not 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 the context clearly indicates otherwise. 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. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
It will be understood by those skilled in the art that the "terminal" and "terminal Device" used herein may also be a communication terminal, an Internet access terminal, and a music/video playing terminal, such as a PDA, an MID (Mobile Internet Device) and/or a Mobile phone with music/video playing function, and may also be a smart tv, a set-top box, and the like.
As shown in fig. 1, fig. 1 is a diagram of an implementation environment of a hardware encoder detection method provided in an embodiment, and in the implementation environment, a hardware encoder 110 and a decoder 120 are included.
The hardware encoder 110 may be created according to encoding parameters such as a test code rate, a test resolution, a test frame rate, and a test code stream. The decoder 120 is a decoder corresponding to the hardware encoder 110, and can decode encoded data having the encoding parameters of the hardware encoder 110. The hardware encoder 110 may be an encoder mounted on hardware of the terminal, for example, an IP core of the terminal, and the hardware encoder 110 may be mounted on a graphics processor. The decoder 120 may be a software decoder hosted by a central processor.
The hardware encoder 110 is input with a test sequence, which is uncoded video stream data, which may be video stream data of a game scene or video stream data of a live scene. The hardware encoder 110 encodes uncoded video stream data and outputs encoded frames. The software decoder 120 may obtain the encoded frame output by the hardware encoder 110, decode the encoded frame, and obtain a decoded frame after decoding.
In an embodiment, as shown in fig. 2, fig. 2 is a flowchart of a hardware encoder detection method of an embodiment, and the embodiment proposes a hardware encoder detection method, which can be applied to the hardware encoder 110, and specifically includes the following steps:
step S210: and inputting the test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters.
The test sequence is uncoded video stream data, i.e. a bare stream. The hardware encoder is established according to the corresponding encoding parameters under the preset function, so that the hardware encoder is set to have the preset function.
Step S220: and acquiring output data of the hardware encoder, and calculating test performance parameters of the hardware encoder according to the output data.
Although the hardware encoder is created according to the encoding parameters, it is not yet determined whether the actual encoding performance of the hardware encoder can reach the preset function corresponding to the encoding parameters, so in this step, the current actual performance of the hardware encoder needs to be estimated according to the output data of the hardware encoder, and the performance of the hardware encoder is represented by testing the performance parameters.
Parameters capable of reflecting the performance of the hardware encoder comprise a peak signal-to-noise ratio for reflecting the encoding quality, an output code rate for reflecting the encoding reliability, a delay time for reflecting the encoding speed and the like.
Step S230: and comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder, wherein the parameter reference value is set according to a preset encoding parameter.
When the actual performance of the hardware encoder cannot meet the requirement of the preset function, the performance parameters presented by the hardware encoder often deviate far from the expected encoding parameters, and when the deviation degree exceeds the tolerance value, the hardware encoder is considered to be in an unavailable state.
The hardware encoder in the unavailable state can affect the quality and efficiency of video transmission and playing, for example, the encoding quality of the hardware encoder cannot reach the expected performance, the peak signal-to-noise ratio is too high, so that the video distortion of encoding and decoding is serious, even the screen-splash phenomenon is caused, the video is unavailable, and the reliability of the hardware encoder is low; in addition, resources used in the middle and generated data are wasted, and therefore, manpower and material resources are wasted by the hardware encoder in an unavailable state, and efficiency is low.
According to the hardware encoder detection method, the reliability of the hardware encoder can be improved through the hardware encoder which detects the available state, so that the quality and efficiency of video transmission and playing are improved subsequently, and the cost of manpower and material resources is reduced.
In one embodiment, the preset encoding parameters include: testing code rate, testing resolution, testing frame rate and testing code stream; before the step of inputting the test sequence into the hardware encoder for testing in step S210, the method further includes:
240: and creating a hardware encoder according to the test code rate, the test resolution, the test frame rate and the test code stream.
According to the hardware encoder detection method, the hardware encoder is established according to the preset encoding parameters, the preset performance of the hardware encoder can be adjusted, the types of the hardware encoder which can be established can be increased, and the range of the hardware encoder which can be tested is enlarged.
In one embodiment, the output data comprises output encoded data, the test performance parameter comprises a code rate deviation value, and the parameter reference value comprises a code rate deviation tolerance value. An important performance of a hardware encoder is encoding, and therefore the output encoded data of the hardware encoder related to encoding is mainly observed. The code rate deviation value is mainly used for representing a deviation value existing between an actually output code rate and an expected output code rate of a hardware encoder in the encoding function, and the code rate deviation tolerance value is a parameter reference value considering whether the hardware encoder is available or not in the output code rate.
The step of calculating the test performance parameter of the hardware encoder according to the output data in step S220 may include: 221-A obtains output coded data of the hardware encoder, and calculates a code rate deviation value between the output code rate of the hardware encoder and the expected output code rate according to the output coded data.
The output code rate of the hardware encoder is related to the data volume of the output coded data which is output after being coded by the hardware encoder, and the expected output code rate is related to the preset coding parameters. In one embodiment, the code rate deviation value is calculated, and if the data amount of the encoded data output by the hardware encoder is close to the expected output data amount within a certain time, it indicates that the code rate output by the hardware encoder is also close to the expected output code rate, and the code rate deviation value is smaller.
The step of comparing the performance parameter with the set parameter reference value in step S230 to determine the available state of the hardware encoder may include: 231-A compares the code rate deviation value with the code rate deviation tolerance value, and determines that the state of the hardware encoder is an available state when the code rate deviation value is greater than the code rate deviation tolerance value.
When the code rate deviation value is greater than the code rate deviation tolerance value, the fluctuation of the output coded data quantity is too large, and the efficiency of the system where the code rate deviation value is located is affected. When the output data volume is too high, the number of coded frames is too much, the uploading rate cannot keep pace with the output code rate of the hardware encoder, so that a large number of coded frames wait for uploading in a buffer queue, and as the backlog of the coded frames is increased, higher memory resources are consumed, the equipment runs slowly, even the equipment is blocked, and the stability and the efficiency of a system where the equipment is located are greatly reduced. When the output data volume is too low, the coding speed is low, the time for waiting for the completion of coding is too long, especially the coding requirement of the video stream cannot be met, and the video live broadcast effect is poor. Therefore, the code rate deviation value is low, the output code rate of the hardware encoder is close to the expected output code rate, the system stability is kept, the system performance is improved, and the usability of the hardware encoder is high.
In one embodiment, the step of calculating a code rate offset value between the output code rate of the hardware encoder and the expected output code rate according to the output coded data in 221-a may include:
221-A (1): when the hardware encoder outputs any encoding frame, the output value of the encoder is counted, and the total output data volume output by the hardware encoder is accumulated according to the data volume of the encoding frame.
In this step, the encoder output value refers to the number of frames of the encoded frame that has been output by the hardware encoder, and each time the hardware encoder outputs one encoded frame, the encoder output value is accumulated by 1. The output coded data is accumulated every time, and the total output data volume is calculated.
221-A (2): and calculating a code rate deviation value according to the counted encoder output value and the accumulated total output data.
The amount of data expected to be output can be calculated by predicting the amount of data per encoded frame, and then combining the number of frames for which encoded frames have been output. The code rate deviation value is a ratio of the expected deviation and can be calculated by the following formula:
Figure BDA0001930681800000101
according to the hardware encoder detection method, the code rate deviation value can be calculated through the output data quantity, calculation is simple and convenient, and efficiency is improved.
In one embodiment, the step of calculating the code rate offset value according to the counted encoder output value and the accumulated total output data amount in 221-a (2) includes:
a: and acquiring the output code rate and the test frame rate of the hardware encoder.
The output code rate and the test frame rate may be obtained from preset encoding parameters when the hardware encoder is created.
A (II): and calculating the expected output data volume according to the counted encoder output value, the output code rate and the test frame rate.
In this step, the data size of each expected output coded frame can be obtained according to the ratio between the output code rate and the test frame rate, and then the data size of the expected output can be calculated according to the actual output frame number, that is, the output value of the encoder, which may specifically include the following formula:
EP=EncOut×EncBitrate/TEST_FPS
where EP is the expected output data amount, EncOut is the counted encoder output value, EncBitrate is the output code rate, and TEST _ FPS is the TEST frame rate.
And (A): and calculating a code rate deviation value according to the total accumulated output data quantity and the expected output data quantity.
In this step, as described in the previous embodiment, the code rate deviation value may be calculated by the output data amount, and specifically may include the following formula:
bitrateOffset=abs(BITALL-EP)×100%/EP
wherein bitrate offset is a code rate deviation value, bitlal is an accumulated total output data amount, EP is an expected output data amount, and abs (·) is an absolute value taking function.
The hardware encoder detection method can accurately calculate the encoding deviation value through the preset encoding parameters and the number of actually output encoding frames, and combines the preset encoding parameters of the hardware encoder, so that the calculation of the encoding deviation value is accurate and simple.
In one embodiment, the output data comprises output encoded data, the test performance parameter comprises an average peak signal-to-noise ratio, and the parameter reference value comprises a signal-to-noise ratio threshold. The encoded data encoded by the hardware encoder also needs to be decoded to display a corresponding image, so whether the encoded data output by the hardware encoder can be correctly decoded into an image meeting the requirements needs to be considered, and the performance of the hardware encoder is judged by detecting the peak signal-to-noise ratio of the image after encoding and decoding.
The step of calculating the test performance parameter of the hardware encoder according to the output data in step S220 may include: 221-B: and acquiring output coded data of the hardware encoder, and acquiring the average peak signal-to-noise ratio of the decoded output coded data.
In this step, the encoded output encoded data is decoded, and then the average peak signal-to-noise ratio of the decoded data is calculated. In order to avoid the fluctuation caused by random detection, the average peak signal-to-noise ratio can be obtained in a statistical manner.
The step of comparing the performance parameter with the set parameter reference value in step S230 to determine the available state of the hardware encoder may include:
231-B: and comparing the average peak signal-to-noise ratio with a signal-to-noise ratio threshold, and judging the state of the hardware encoder to be an available state when the peak signal-to-noise ratio is smaller than the signal-to-noise ratio threshold.
When the average peak signal-to-noise ratio is too high, the phenomenon that the decoded picture generally generates screen splash can be caused, the quality of the video is seriously influenced, and the usability of the hardware encoder is low at the moment. When the average peak signal-to-noise ratio is low and the video quality is good, the usability of the hardware encoder is high, and the state of the hardware encoder can be judged to be an available state.
In one embodiment, the step of obtaining the average peak snr of the decoded average peak snr of the output encoded data in 221-B may include:
b, firstly: acquiring a coded frame output by a hardware encoder;
b, B: inputting the coded frame into a decoder for decoding to obtain a decoded frame of the coded frame;
and B, third step: calculating the peak signal-to-noise ratio of the decoded frame;
b, B four: and accumulating the peak signal-to-noise ratio total value according to the peak signal-to-noise ratio of the decoded frame, and calculating the average peak signal-to-noise ratio of the hardware encoder according to the accumulated peak signal-to-noise ratio total value.
And calculating the average peak signal-to-noise ratio of the hardware encoder according to the accumulated total peak signal-to-noise ratio value, specifically, averaging the total peak signal-to-noise ratio value according to the number of output encoding frames to obtain the average peak signal-to-noise ratio.
The hardware encoder detection method specifically counts the average peak signal-to-noise ratio, and embodies the average performance of the hardware encoder.
In one embodiment, the decoder is a software decoder corresponding to a hardware encoder, and before the step of B · inputting the encoded frame into the decoder for decoding, the method may further include:
b, fifth step: and creating a software decoder according to the test code rate, the test resolution, the test frame rate and the test code stream of the hardware encoder.
According to the detection method of the hardware encoder, the software decoder is matched with the parameters of the coding and decoding of the hardware encoder, so that the software decoder can decode the output coded data of the hardware encoder.
In one embodiment, the output data comprises encoded frames, the test performance parameter comprises a delay time, and the parameter reference value comprises a delay tolerance value;
the step of calculating the test performance parameter of the hardware encoder according to the output data in step S220 may include:
221-C: counting the number of delay output frames of a hardware encoder;
222-C: and calculating the delay time according to the delay output frame number and the test frame rate.
The number of delay output frames can be counted visually, so that the delay time can be calculated by using the preset test frame rate, and the measurement of the delay time is simplified.
The step of determining the available state of the hardware encoder according to the comparison result between the set parameter reference value and the performance parameter in step S230 may include:
231-C: and comparing the delay time with a delay tolerance value, and judging the state of the hardware encoder to be an available state when the delay time is greater than the delay tolerance value.
For example, in a scene of a live video, when the delay time in the encoding process is too long, even if the decoding capability of a subsequent decoder is excellent, the video played by decoding is obviously delayed, the live frame is delayed and played, the live real-time performance is reduced, the video playing is greatly influenced, and the usability of a hardware encoder at this time is low. When the time delay of a hardware encoder used in live broadcasting is low, the real-time performance of live broadcasting is strong, and the state of the hardware encoder at the moment can be judged to be an available state.
In one embodiment, the step of counting the number of delayed output frames of the hardware encoder in 221-C comprises:
c: when any test sequence is input into the hardware encoder, counting the input value of the encoder;
c, C ^ C: when the hardware encoder outputs any encoding frame, counting the output value of the encoder;
c, third step: and taking the difference value of the counted encoder input value and the counted encoder output value as the number of delay output frames.
Each time a test sequence representing one frame is input to the hardware encoder, the encoder input value is incremented by 1, and the initial value of the encoder input value is 0. The encoder output value refers to the number of frames that the hardware encoder has output encoded frames, and the encoder output value is incremented by 1 each time the hardware encoder outputs one encoded frame.
The hardware encoder detection method can simply detect the input test sequence and the output encoding frame and quickly obtain the number of the delay output frames.
In one embodiment, after the step of determining the available state of the hardware encoder, the method further comprises:
acquiring output data output by the hardware encoder next time;
the step of calculating test performance parameters of the hardware encoder from the output data is performed.
The hardware encoder detection method can detect the usability of the hardware encoder at preset time intervals, and is convenient for detecting the hardware encoder in real time.
In another embodiment, as shown in fig. 3, fig. 3 is a flow chart of a hardware encoder detection method in another embodiment. The embodiment provides a hardware encoder detection method, which is applied to hardware encoding detection, automatically detects various data of a hardware encoder, and outputs the usability of a hardware encoder, and comprises the following steps:
s310: setting coding parameters of a hardware encoder, wherein the coding parameters comprise a test code rate, a test resolution, a test frame rate and a test code stream, and establishing the hardware encoder according to the coding parameters; while creating a software decoder corresponding to the hardware encoder.
S320: when a test sequence representing a frame is input to the hardware encoder, the encoder input value is incremented by 1. The initial value of the encoder input value is 0, and specifically includes the formula: EncInput +1, where EncInput is the encoder input value.
S330: when the hardware encoder outputs an encoded frame, the encoder output value is accumulated by 1. The initial value of the encoder output value is 0, and specifically includes the formula: EncOut +1, where EncOut is the encoder output value.
S340: and when the encoder outputs the encoded output for the first time, taking the difference value of the encoder input value and the encoder output value as the delay time. The method specifically comprises the following formula: EncDelay is EncInput-EncOut, and EncDelay is delay time.
S350: acquiring a coded frame output by a hardware encoder, inputting the coded frame into a decoder for decoding, acquiring a decoded frame of the coded frame, calculating a peak signal-to-noise ratio of the decoded frame, accumulating a total value of the peak signal-to-noise ratio according to the peak signal-to-noise ratio of the decoded frame, and calculating an average peak signal-to-noise ratio of the hardware encoder according to the accumulated total value of the peak signal-to-noise ratio. The method specifically comprises the following formula: psrall is psrall + psnr, where psrall is the total peak snr and psnr is the peak snr of the decoded frame.
S360: when the hardware encoder outputs any encoding frame, the total output data volume output by the hardware encoder is accumulated according to the data volume of the encoding frame. The method specifically comprises the following formula: bital + outSize, where bital is the total output data amount and outSize is the data amount of the encoded frame.
S370: calculating the deviation between the output code rate and the expected code rate, namely a code rate deviation value, and specifically comprising the following formula:
EP=EncOut×EncBitrate/TEST_FPS,
bitrateOffset=abs(BITALL-EP)×100%/EP,
where EP is the expected output data amount, EncOut is the counted encoder output value, EncBitrate is the output code rate, TEST _ FPS is the TEST frame rate, bitrate offset is the code rate offset value, bital is the total output data amount after accumulation, and abs (·) is the absolute value taking function.
S380: setting a tolerable delay tolerance value, a maximum tolerable code rate deviation tolerance value and a signal-to-noise ratio threshold value for the application using the hardware encoder;
s390: and if the code rate deviation value is greater than the code rate deviation tolerance value, or the average peak signal-to-noise ratio is less than the signal-to-noise ratio threshold value, or the delay time is greater than the delay tolerance value, judging that the state of the hardware encoder is an unavailable state, otherwise, judging that the state of the hardware encoder is an available state.
The hardware encoder detection method can well detect the usability of the hardware encoder, and the reliability of the hardware encoder can be improved by detecting the hardware encoder in the usable state, so that the quality and efficiency of video transmission and playing are improved subsequently, and the cost of manpower and material resources is reduced.
In an embodiment, as shown in fig. 4, fig. 4 is a schematic structural diagram of a hardware encoder detection apparatus in an embodiment, and in this embodiment, a hardware encoder detection apparatus is provided, which includes a test sequence input module 410, a performance calculation module 420, and a state determination module 430, where:
and a test sequence input module 410, configured to input a test sequence into a hardware encoder for testing, where the hardware encoder is an encoder created according to preset encoding parameters.
And the performance calculating module 420 is configured to obtain output data of the hardware encoder, and calculate a test performance parameter of the hardware encoder according to the output data.
The state determining module 430 is configured to compare the performance parameter with a set parameter reference value, and determine an available state of the hardware encoder, where the parameter reference value is set according to the preset encoding parameter.
When the actual performance of the hardware encoder cannot meet the requirement of the preset function, the performance parameters presented by the hardware encoder often deviate far from the expected encoding parameters, and when the deviation degree exceeds the tolerance value, the hardware encoder is considered to be in an unavailable state.
The hardware encoder in the unavailable state can affect the quality and efficiency of video transmission and playing, for example, the encoding quality of the hardware encoder cannot reach the expected performance, the peak signal-to-noise ratio is too high, so that the video distortion of encoding and decoding is serious, even the screen-splash phenomenon is caused, the video is unavailable, and the reliability of the hardware encoder is low; in addition, resources used in the middle and generated data are wasted, and therefore, manpower and material resources are wasted by the hardware encoder in an unavailable state, and efficiency is low.
Above-mentioned hardware encoder detection device can improve hardware encoder's reliability through detecting out the hardware encoder of available state to follow-up quality and the efficiency of improving video transmission and broadcast, reduce manpower and materials cost.
For specific limitations of the hardware encoder detection apparatus, reference may be made to the above limitations of the hardware encoder detection method, which is not described herein again. The modules in the hardware encoder detection device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
An embodiment of the present invention further provides a mobile terminal, as shown in fig. 5, fig. 5 is a schematic structural diagram of the terminal in an embodiment, and for convenience of description, only a portion related to the embodiment of the present invention is shown, and details of the specific technology are not disclosed, please refer to a method portion in the embodiment of the present invention. The terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (personal digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, etc., taking the terminal as the mobile phone as an example:
fig. 5 is a block diagram illustrating a partial structure of a mobile phone related to a terminal provided in an embodiment of the present invention. Referring to fig. 5, the handset includes: radio Frequency (RF) circuitry 1510, memory 1520, input unit 1530, display unit 1540, sensor 1550, audio circuitry 1560, wireless fidelity (Wi-Fi) module 1570, processor 1580, and power supply 1590. Those skilled in the art will appreciate that the handset configuration shown in fig. 5 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In this embodiment of the present invention, the processor 1580 included in the terminal further has the following functions: inputting the test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters; acquiring output data of a hardware encoder, and calculating test performance parameters of the hardware encoder according to the output data; and comparing the performance parameter with a set parameter reference value to determine the available state of the hardware encoder, wherein the parameter reference value is set according to a preset encoding parameter. That is, the processor 1580 has a function of executing the hardware encoder detection method according to any of the above embodiments, which is not described herein again.
As shown in fig. 6, fig. 6 is a schematic diagram of an internal structure of a computer device in one embodiment. The computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected by a system bus. The non-volatile storage medium of the computer device stores an operating system, a database and computer readable instructions, the database can store control information sequences, and the computer readable instructions when executed by the processor can enable the processor to realize the hardware encoder detection method. The processor of the computer device is used for providing calculation and control capability and supporting the operation of the whole computer device. The memory of the computer device may have stored therein computer readable instructions that, when executed by the processor, may cause the processor to perform a hardware encoder detection method. The network interface of the computer device is used for connecting and communicating with the terminal. Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is proposed, which comprises a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the hardware encoder detection method of any of the above embodiments when executing the computer program.
In one embodiment, a storage medium is provided that stores computer readable instructions, which when executed by one or more processors, cause the one or more processors to perform the steps of the hardware encoder detection method of any of the above embodiments.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (13)

1. A hardware encoder detection method is characterized by comprising the following steps:
inputting a test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters;
acquiring output data of the hardware encoder, and calculating test performance parameters of the hardware encoder according to the output data, wherein the output data comprises encoded frames, and the test performance parameters comprise code rate deviation values, and the method comprises the following steps: when the hardware encoder outputs any encoding frame, counting the output value of the encoder, and accumulating the total output data volume output by the hardware encoder according to the data volume of the encoding frame; calculating the code rate deviation value according to the counted encoder output value and the accumulated total output data quantity, wherein the method comprises the following steps: acquiring an output code rate and a preset test frame rate of the hardware encoder, calculating an expected output data volume according to the counted encoder output value, the output code rate and the test frame rate, and calculating a code rate deviation value according to the accumulated total output data volume and the expected output data volume;
and comparing the test performance parameter with a set parameter reference value to determine the available state of the hardware encoder, wherein the parameter reference value is set according to the preset encoding parameter.
2. The hardware encoder detection method of claim 1, wherein the preset encoding parameters comprise: testing code rate, testing resolution, testing frame rate and testing code stream;
before the step of inputting the test sequence into the hardware encoder for testing, the method further comprises:
and establishing the hardware encoder according to the test code rate, the test resolution, the test frame rate and the test code stream.
3. The hardware encoder detection method of claim 2, wherein the output data comprises output encoded data, the test performance parameter comprises a code rate deviation value, and the parameter reference value comprises a code rate deviation tolerance value;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
acquiring output coded data of the hardware encoder, and calculating a code rate deviation value between the output code rate of the hardware encoder and the expected output code rate according to the output coded data;
the step of comparing the test performance parameter with a set parameter reference value to determine the available state of the hardware encoder includes:
and comparing the code rate deviation value with the code rate deviation tolerance value, and judging that the state of the hardware encoder is an available state when the code rate deviation value is smaller than the code rate deviation tolerance value.
4. The hardware encoder detection method of claim 3, wherein the step of calculating the expected output data amount according to the counted encoder output value, the output code rate and the test frame rate comprises the following formula:
EP=EncOut×EncBitrate/TEST_FPS
wherein EP is the expected output data amount, EncOut is the counted encoder output value, EncBitrate is the output code rate, and TEST _ FPS is the TEST frame rate;
the step of calculating the code rate deviation value according to the accumulated total output data volume and the expected output data volume comprises the following formula:
bitrateOffset=abs(BITALL-EP)×100%/EP
wherein bitrate offset is the code rate deviation value, bitlal is the total output data amount after accumulation, EP is the expected output data amount, and abs (·) is an absolute value taking function.
5. The hardware encoder detection method of claim 2, wherein the output data comprises output encoded data, the test performance parameter comprises an average peak signal-to-noise ratio, and the parameter reference value comprises a signal-to-noise ratio threshold;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
acquiring output coded data of the hardware encoder, and acquiring an average peak signal-to-noise ratio after the output coded data are decoded;
the step of comparing the test performance parameter with a set parameter reference value to determine the available state of the hardware encoder includes:
and comparing the average peak signal-to-noise ratio with the signal-to-noise ratio threshold, and judging the state of the hardware encoder to be an available state when the peak signal-to-noise ratio is smaller than the signal-to-noise ratio threshold.
6. The hardware encoder detection method of claim 5, wherein said outputting encoded data comprises encoding frames, and the step of obtaining the average peak signal-to-noise ratio of the decoded output encoded data comprises:
acquiring a coded frame output by the hardware encoder;
inputting the coding frame into a decoder for decoding to obtain a decoding frame of the coding frame;
calculating a peak signal-to-noise ratio of the decoded frame;
and accumulating the peak signal-to-noise ratio total value according to the peak signal-to-noise ratio of the decoded frame, and calculating the average peak signal-to-noise ratio of the hardware encoder according to the accumulated peak signal-to-noise ratio total value.
7. The hardware encoder detection method of claim 6, wherein the decoder is a software decoder corresponding to the hardware encoder, and further comprising, before the step of inputting the encoded frame into a decoder for decoding:
and creating the software decoder according to the test code rate, the test resolution, the test frame rate and the test code stream of the hardware encoder.
8. The hardware encoder detection method of claim 2, wherein the output data comprises an encoded frame, the test performance parameter comprises a delay time, the parameter reference value comprises a delay tolerant value;
the step of calculating the test performance parameters of the hardware encoder according to the output data comprises:
counting the number of delay output frames of the hardware encoder;
calculating the delay time according to the delay output frame number and the test frame rate;
the step of determining the available state of the hardware encoder according to the comparison result between the set parameter reference value and the test performance parameter includes:
and comparing the delay time with the delay tolerance value, and judging the state of the hardware encoder to be an available state when the delay time is less than the delay tolerance value.
9. The hardware encoder detection method of claim 8, wherein the step of counting the number of frames of the delayed output of the hardware encoder comprises:
counting encoder input values when any one test sequence is input into the hardware encoder;
counting an encoder output value when the hardware encoder outputs any one of the encoded frames;
and taking the difference value of the counted encoder input value and the counted encoder output value as the delay output frame number.
10. A hardware encoder detection apparatus, comprising:
the test sequence input module is used for inputting a test sequence into a hardware encoder for testing, wherein the hardware encoder is an encoder established according to preset encoding parameters;
a performance calculation module, configured to obtain output data of the hardware encoder, and calculate a test performance parameter of the hardware encoder according to the output data, where the output data includes an encoded frame, and the test performance parameter includes a code rate deviation value, and the performance calculation module includes: when the hardware encoder outputs any encoding frame, counting the output value of the encoder, and accumulating the total output data volume output by the hardware encoder according to the data volume of the encoding frame; calculating the code rate deviation value according to the counted encoder output value and the accumulated total output data quantity, wherein the method comprises the following steps: acquiring an output code rate and a preset test frame rate of the hardware encoder, calculating an expected output data volume according to the counted encoder output value, the output code rate and the test frame rate, and calculating a code rate deviation value according to the accumulated total output data volume and the expected output data volume;
and the state judgment module is used for comparing the test performance parameter with a set parameter reference value and determining the available state of the hardware encoder, wherein the parameter reference value is set according to the preset encoding parameter.
11. A terminal, characterized in that it comprises:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: performing the hardware encoder detection method according to any of claims 1 to 9.
12. A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions, wherein the computer-readable instructions, when executed by the processor, cause the processor to perform the steps of the hardware encoder detection method of any one of claims 1 to 9.
13. A storage medium having computer-readable instructions stored thereon, which, when executed by one or more processors, cause the one or more processors to perform the steps of the hardware encoder detection method of any one of claims 1 to 9.
CN201811638773.7A 2018-12-29 2018-12-29 Hardware encoder detection method and device and terminal Active CN111385563B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811638773.7A CN111385563B (en) 2018-12-29 2018-12-29 Hardware encoder detection method and device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811638773.7A CN111385563B (en) 2018-12-29 2018-12-29 Hardware encoder detection method and device and terminal

Publications (2)

Publication Number Publication Date
CN111385563A CN111385563A (en) 2020-07-07
CN111385563B true CN111385563B (en) 2022-03-01

Family

ID=71218166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811638773.7A Active CN111385563B (en) 2018-12-29 2018-12-29 Hardware encoder detection method and device and terminal

Country Status (1)

Country Link
CN (1) CN111385563B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112601074B (en) * 2020-11-30 2022-10-11 北京金山云网络技术有限公司 Method and device for evaluating encoder, computer equipment and storage medium
CN114051142B (en) * 2022-01-13 2022-04-29 深圳市麦谷科技有限公司 Hardware multi-channel coding anti-shake method and device, intelligent terminal and storage medium
CN114501017A (en) * 2022-03-04 2022-05-13 百果园技术(新加坡)有限公司 Video coding adaptation method, device, equipment and storage medium
CN115209223A (en) * 2022-05-12 2022-10-18 广州方硅信息技术有限公司 Control processing method, device, terminal and storage medium for video coding/decoding
CN117395434B (en) * 2023-12-07 2024-03-26 西安芯云半导体技术有限公司 Hardware encoding and decoding debugging method, device, equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895788B (en) * 2010-07-21 2013-07-03 深圳市融创天下科技股份有限公司 Method and system for objectively evaluating video coding performance
CN102026017B (en) * 2010-11-29 2012-08-08 福州瑞芯微电子有限公司 Efficient test method for video decoding
CN102158726A (en) * 2011-01-28 2011-08-17 北京视博云科技有限公司 Time delay detection method and device of encoder
CN104159113B (en) * 2014-06-30 2018-08-10 北京奇艺世纪科技有限公司 The selection method and device of Video coding mode in Android system
CN108076351B (en) * 2016-11-16 2020-12-08 杭州海康威视数字技术股份有限公司 Audio and video data encoding method and device and electronic equipment

Also Published As

Publication number Publication date
CN111385563A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
CN111385563B (en) Hardware encoder detection method and device and terminal
US11423942B2 (en) Reference and non-reference video quality evaluation
US11323739B2 (en) Method and apparatus for video encoding and decoding
US8588296B2 (en) Bitrate control algorithm for video transcoding systems
US9936208B1 (en) Adaptive power and quality control for video encoders on mobile devices
US9883214B2 (en) Efficient approach to dynamic frame size and frame rate adaptation
US20090290641A1 (en) Digital video compression acceleration based on motion vectors produced by cameras
JP2011061811A (en) Method and apparatus for motion compensated frame rate up conversion
US9154820B2 (en) Encoding apparatus, encoding method, and storage medium
US9344678B2 (en) Information processing apparatus, information processing method and computer-readable storage medium
KR20140005261A (en) System and method for enhanced remote transcoding using content profiling
US7956898B2 (en) Digital image stabilization method
CN112995679A (en) Motion adaptive coding of video
Bienik et al. Impact of constant rate factor on objective video quality assessment
US8472529B2 (en) Estimating complexity of video frames for encoding
CN106254873B (en) Video coding method and video coding device
CN112055174B (en) Video transmission method and device and computer readable storage medium
JP7431514B2 (en) Method and system for measuring quality of video call service in real time
US20210350515A1 (en) System and method to detect macroblocking in images
KR101164313B1 (en) Video encoding error detecting system and method
US20230247069A1 (en) Systems and Methods for Adaptive Video Conferencing
US9503756B2 (en) Encoding and decoding using perceptual representations
KR101465148B1 (en) Apparatus for encoding/decoding video and method thereof
JP2016207084A (en) Video quality evaluation device, mobile terminal, video quality evaluation method, and program
CN114745590A (en) Video frame encoding method, video frame encoding device, electronic device, and medium

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
TR01 Transfer of patent right

Effective date of registration: 20221116

Address after: 31a, 15 / F, building 30, maple mall, bangrang Road, Brazil, Singapore

Patentee after: Baiguoyuan Technology (Singapore) Co.,Ltd.

Address before: Building B-1, North District, Wanda Commercial Plaza, Wanbo business district, No. 79, Wanbo 2nd Road, Nancun Town, Panyu District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU BAIGUOYUAN INFORMATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right