WO2018145561A1 - 一种码率控制的方法、电子设备以及计算机可读存储介质 - Google Patents

一种码率控制的方法、电子设备以及计算机可读存储介质 Download PDF

Info

Publication number
WO2018145561A1
WO2018145561A1 PCT/CN2018/073016 CN2018073016W WO2018145561A1 WO 2018145561 A1 WO2018145561 A1 WO 2018145561A1 CN 2018073016 W CN2018073016 W CN 2018073016W WO 2018145561 A1 WO2018145561 A1 WO 2018145561A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
layer
code rate
parameter
control
Prior art date
Application number
PCT/CN2018/073016
Other languages
English (en)
French (fr)
Inventor
毛煦楠
谷沉沉
时永方
郭耀耀
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018145561A1 publication Critical patent/WO2018145561A1/zh

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
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/107Selection of coding mode or of prediction mode between spatial and temporal predictive coding, e.g. picture refresh
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/30Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using hierarchical techniques, e.g. scalability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/24Systems for the transmission of television signals using pulse code modulation

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method for rate control, an electronic device, and a computer readable storage medium.
  • Target rate control is one of the important technologies of video coding and plays an important role in applications such as video storage and transmission. The way of target rate control will directly determine the pros and cons of video coding.
  • the coding method adopted in the prior art is a Hierarchical encoding method, and the hierarchical coding structure is a hierarchical video coding model.
  • the three-layer coding structure of I frame and P is taken as an example, and the I frame is Intra prediction frames, only intra prediction is used.
  • the P frame is an inter prediction frame, and may adopt intra prediction and inter prediction.
  • the frame level of the frame P1 is layer 0, the frame level of the frame P2 is layer 1, and the frame level of the frame P3 is layer 2, as shown in FIG. 1 .
  • Each P frame shown has only one reference frame. The specific reference relationship is shown in Figure 1.
  • P0 is the referenced frame of P1 and P2, P1 can be referenced by P2, and P2 cannot be referenced.
  • the prior art only performs target rate control on P0, and other layer frames do not perform target rate control, but use the layer-based fixed value of the nearest P0 frame as a quantization parameter. It can be seen that the target rate control method shown in the prior art is used because only the target rate control is performed on the P0 frame, and when the coding mode is greater than or equal to three layers, the number of non-P0 frames is greater than the number of P0 frames, The target rate control is inaccurate, especially the target code rate is less stable.
  • Embodiments of the present invention provide a method, an electronic device, and a computer readable storage medium capable of improving target rate control accuracy and target rate stability.
  • a first aspect of the embodiments of the present invention provides a method for rate control, including:
  • the pre-control target code rate is a code rate of a current frame in the video stream, and the current frame is an inter-frame predicted frame in the video stream;
  • Pre-control target code rate of the current frame by the pre - control target code rate ratio T layer_N Control is performed to obtain the controlled target code rate R i .
  • a second aspect of the embodiments of the present invention provides an electronic device, including:
  • a first acquiring unit configured to acquire a target code rate before control
  • the pre-control target code rate is a code rate of a current frame in the video stream, and the current frame is an inter-frame predicted frame in the video stream;
  • a second acquiring unit configured to obtain a pre-control target code rate ratio T layer-N , where the pre - control target code rate ratio corresponds to a target layer coding structure, and the target layer coding structure is any layer in the N layer coding structure a coding structure, the N being a positive integer greater than or equal to 0;
  • a third acquiring unit configured to control a target code rate of the current frame by using the pre - control target code rate ratio T layer-N Control is performed to obtain the controlled target code rate R i .
  • a third aspect of the embodiments of the present invention provides an electronic device, including:
  • processors One or more processors, memories, bus systems, and one or more programs, the processors and the memories being coupled by the bus system;
  • the one or more programs are stored in the memory, the one or more programs comprising instructions that, when executed by the electronic device, cause the electronic device to perform as shown in the first aspect above Methods.
  • a fourth aspect of the embodiments of the present invention provides a computer readable storage medium storing program instructions, and when the processor executes the stored program instructions, performing the method as shown in the first aspect above.
  • the embodiment of the present invention provides a method for controlling rate control, an electronic device, and a computer readable storage medium.
  • the method shown in this embodiment first calculates a target code rate before control of a current frame in a video stream. And assigning a pre-control target code rate ratio T layer_N to the target layer coding structure, and controlling the pre - control target code rate of the current frame according to the pre-control target code rate ratio T layer-N Control is performed to obtain the controlled target code rate R i . It can be seen that, according to the characteristics of the video, different pre-control target code rate ratios T layer-N can be allocated according to the characteristics of the video, so that different characteristics according to the characteristics of the video can be realized.
  • the target layer coding structure allocates different control target code rates R i of the current frame, and can ensure the control of the current frame according to the characteristics of the video stream under the premise of ensuring the accuracy and stability of the target rate control.
  • Target bit rate By performing the correction, the target code rate of different levels of frames can be allocated according to the video characteristics of the video stream by the method shown in this embodiment, and the video compression efficiency can be improved.
  • FIG. 1 is a diagram showing an example of the structure of a three-layer coding structure provided by the prior art
  • FIG. 2 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
  • FIG. 3 is a flow chart of steps of an embodiment of a method for rate rate control according to the present invention.
  • FIG. 4 is a schematic diagram of an embodiment of a target correspondence list provided by the present invention.
  • FIG. 5 is a schematic diagram of another embodiment of a target correspondence list provided by the present invention.
  • FIG. 6 is a schematic diagram of another embodiment of a target correspondence list provided by the present invention.
  • FIG. 7 is a schematic structural diagram of another embodiment of an electronic device according to the present invention.
  • FIG. 8 is a flow chart of steps of another embodiment of a method for rate rate control according to the present invention.
  • the embodiment of the present invention provides a method for rate control.
  • the electronic device includes components such as an input unit 205, a processor 203, an output unit 201, a communication unit 207, a memory 204, a radio frequency circuit 208, and the like.
  • FIG. 2 does not constitute a limitation of the present invention, and it may be a bus-shaped structure or a star-shaped structure, and may include more or more than the illustration. There are few parts, or some parts are combined, or different parts are arranged.
  • the electronic device may be any mobile or portable electronic device, including but not limited to a smart phone, a mobile computer, a tablet computer, a personal digital assistant (PDA), a media player, a smart TV. Wait.
  • a smart phone a mobile computer
  • a tablet computer a personal digital assistant (PDA)
  • PDA personal digital assistant
  • media player a smart TV. Wait.
  • the electronic device includes:
  • the output unit 201 is configured to output an image to be displayed.
  • the output unit 201 includes but is not limited to the image output unit 2011 and the sound output unit 2012.
  • the image output unit 2011 is for outputting text, pictures, and/or video.
  • the image output unit 2011 may include a display panel, for example, a liquid crystal display (English name: Liquid Crystal Display, English abbreviation: LCD), an organic light emitting diode (English name: Organic Light-Emitting Diode, English abbreviation: OLED), field emission A display panel configured in the form of a display (English name: field emission display, FED for short).
  • the image output unit 2011 may include a reflective display, such as an electrophoretic display, or a display using an Interferometric Modulation of Light.
  • the image output unit 2011 may include a single display or multiple displays of different sizes.
  • the touch screen can also serve as a display panel of the output unit 201 at the same time.
  • the touch screen detects a touch or proximity gesture operation thereon, it is communicated to the processor 203 to determine the type of touch event, and then the processor 203 provides a corresponding visual output on the display panel depending on the type of touch event.
  • the input unit 205 and the output unit 201 are two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch screen and the display panel may be integrated to implement the electronic device.
  • the image output unit 2011 can display various graphical user interfaces (English full name: Graphical User Interface, English abbreviated as GUI) as virtual control components, including but not limited to windows, scroll axes, icons, and scrapbooks. For users to operate by touch.
  • GUI Graphical User Interface
  • the image output unit 2011 includes a filter and an amplifier for filtering and amplifying the video output by the processor 203.
  • the sound output unit 2012 includes a digital-to-analog converter for converting an audio signal output by the processor 203 from a digital format to an analog format.
  • the processor 203 is configured to run a corresponding code to process the received information to generate and output a corresponding interface.
  • the processor 203 is a control center of the electronic device, and connects various parts of the entire electronic device by using various interfaces and lines, by running or executing software programs and/or modules stored in the storage unit, and calling the storage in the
  • the data within the unit is stored to perform various functions of the electronic device and/or process data.
  • the processor 203 may be composed of an integrated circuit (English name: Integrated Circuit, English abbreviation: IC), for example, may be composed of a single packaged IC, or may be composed of a plurality of packaged ICs with the same function or different functions. .
  • the processor 203 may include only a central processing unit (English full name: Central Processing Unit, English abbreviation: CPU), or may be a graphics processor (English full name: Graphics Processing Unit, English abbreviation: GPU), digital A combination of a signal processor (English name: Digital Signal Processor, English abbreviation: DSP) and a control chip (for example, a baseband chip) in a communication unit.
  • the CPU may be a single operation core, and may also include multiple operation cores.
  • the memory 204 is configured to store code and data for the processor 203 to operate.
  • the memory 204 can be used to store software programs and modules, and the processor 203 executes various functional applications of the electronic device and implements data processing by running software programs and modules stored in the memory 204.
  • the memory 204 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, such as a sound playing program, an image playing program, and the like; and the data storage area can be stored according to the electronic device. Use the created data (such as audio data, phone book, etc.).
  • the memory 204 may include a volatile memory, such as a non-volatile dynamic random access memory (English name: Nonvolatile Random Access Memory, NVRAM for short), phase change random access memory (English full name: Phase Change RAM (PRAM), magnetoresistive random access memory (English full name: Magetoresistive RAM, English abbreviation MRAM), etc., may also include non-volatile memory, such as at least one disk storage device, electronically erasable Programming read-only memory (English full name: Electrically Erasable Programmable Read-Only Memory, EEPROM for short), flash memory devices, such as reverse or flash memory (English full name: NOR flash memory) or reverse flash (English full name: NAND flash memory).
  • NVRAM Nonvolatile Random Access Memory
  • PRAM Phase Change RAM
  • MRAM Magnetoresistive random access memory
  • EEPROM electrically Erasable Programmable Read-Only Memory
  • flash memory devices such as reverse or flash memory (English full name: NOR flash memory) or reverse flash (English full name:
  • the nonvolatile memory stores an operating system and applications executed by the processor 203.
  • the processor 203 loads the running program and data from the non-volatile memory into the memory and stores the digital content in a plurality of storage devices.
  • the operating system includes various components and/or drivers for controlling and managing conventional system tasks such as memory management, storage device control, power management, and the like, as well as facilitating communication between various hardware and software.
  • the operating system may be an Android system of Google Inc., an iOS system developed by Apple Corporation, a Windows operating system developed by Microsoft Corporation, or an embedded operating system such as Vxworks.
  • the application includes any application installed on the electronic device, including but not limited to browsers, email, instant messaging services, word processing, keyboard virtualization, widgets, encryption, digital rights management, voice recognition, Voice copying, positioning (such as those provided by GPS), music playback, and more.
  • the input unit 205 is configured to implement interaction between the user and the electronic device and/or information input into the electronic device.
  • the input unit 205 can receive numeric or character information input by a user to generate a signal input related to user settings or function control.
  • the input unit 205 may be a touch screen, or may be other human-computer interaction interfaces, such as physical input keys, microphones, etc., and may also be other external information capture devices, such as cameras.
  • the touch screen shown in the embodiment of the present invention can collect an operation action touched or approached by a user.
  • the user uses an action of any suitable object or accessory such as a finger, a stylus, or the like on the touch screen or near the touch screen, and drives the corresponding connecting device according to a preset program.
  • the touch screen may include two parts: a touch detection device and a touch controller. Wherein the touch detection device detects a touch operation of the user, converts the detected touch operation into an electrical signal, and transmits the electrical signal to the touch controller; the touch controller receives the electrical signal from the touch detection device, and It is converted into contact coordinates and sent to the processor 203.
  • the touch controller can also receive commands from the processor 203 and execute them.
  • the touch screen can implement touch screens by using various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the physical input keys used by the input unit 205 may include, but are not limited to, a physical keyboard, function keys (such as a volume control button, a switch button, etc.), a trackball, a mouse, a joystick, and the like.
  • a physical keyboard such as a keyboard, function keys (such as a volume control button, a switch button, etc.), a trackball, a mouse, a joystick, and the like.
  • function keys such as a volume control button, a switch button, etc.
  • the input unit 205 in the form of a microphone can collect the voice input by the user or the environment and convert it into a command executable by the processor 203 in the form of an electrical signal.
  • the input unit 205 may also be various types of sensor components, such as Hall devices, for detecting physical quantities of electronic devices, such as force, moment, pressure, stress, position, displacement, Speed, acceleration, angle, angular velocity, number of revolutions, speed, and time when the operating state changes, etc., are converted into electricity for detection and control.
  • sensor components may also include gravity sensors, three-axis accelerometers, gyroscopes, electronic compasses, ambient light sensors, proximity sensors, temperature sensors, humidity sensors, pressure sensors, heart rate sensors, fingerprint readers, and the like.
  • the communication unit 207 is configured to establish a communication channel, enable the electronic device to connect to the remote server through the communication channel, and download media data from the remote server.
  • the communication unit 207 may include a wireless local area network (English name: Wireless Local Area Network, English short: wireless LAN) module, a Bluetooth module, a baseband module, and the like, and a radio frequency corresponding to the communication module (English name: Radio Frequency, English abbreviation: RF) circuit for wireless local area network communication, Bluetooth communication, infrared communication and/or cellular communication system communication, such as broadband code division multiple access (English full name: Wideband Code Division Multiple Access, English abbreviation: W -CDMA) and/or high speed downlink packet access (English full name: High Speed Downlink Packet Access, English abbreviation HSDPA).
  • the communication module is for controlling communication of components in the electronic device and can support direct memory access.
  • the various communication modules in the communication unit 207 generally appear in the form of an integrated circuit chip (English name: Integrated Circuit Chip), and can be selectively combined without including all communication modules. And the corresponding antenna group.
  • the communication unit 207 may include only a baseband chip, a radio frequency chip, and a corresponding antenna to provide communication functions in one cellular communication system.
  • the wireless device can be connected to a cellular network (English name: Cellular Network) or the Internet via a wireless communication connection established by the communication unit 207, such as wireless local area network access or WCDMA access.
  • a communication module, such as a baseband module, in the communication unit 207 may be integrated into the processor 203, typically an APQ+MDM series platform such as that provided by Qualcomm.
  • the radio frequency circuit 208 is configured to receive and transmit signals during information transmission and reception or during a call. For example, after the downlink information of the base station is received, it is processed by the processor 203; in addition, the data for designing the uplink is transmitted to the base station.
  • the radio frequency circuit 208 includes well-known circuits for performing these functions, including but not limited to antenna systems, radio frequency transceivers, one or more amplifiers, tuners, one or more oscillators, digital signal processors, A Codec chipset, a Subscriber Identity Module (SIM) card, a memory, and the like.
  • radio frequency circuitry 208 can also communicate with the network and other devices via wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to a global mobile communication system (English full name: Global System of Mobile communication, English abbreviation: GSM), general packet radio service (English full name: General Packet Radio Service, English abbreviation: GPRS), code division multiple access (English full name: Code Division Multiple Access, English abbreviation: CDMA), wideband code division multiple access (English full name: Wideband Code Division Multiple Access, English abbreviation: WCDMA), high-speed uplink chain Road packet access technology (English full name: High Speed Uplink Packet Access, English abbreviation: HSUPA), long-term evolution (English full name: Long Term Evolution, English abbreviation: LTE), e-mail, short message service (English full name: Short Messaging Service , English abbreviation: SMS) and so on.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • HSUPA High Speed Up
  • a power source 209 is used to power different components of the electronic device to maintain its operation.
  • the power source 209 can be a built-in battery, such as a conventional lithium ion battery, a nickel metal hydride battery, etc., and also includes an external power source that directly supplies power to the electronic device, such as an AC adapter.
  • the power source 209 can also be more widely defined, for example, can also include a power management system, a charging system, a power failure detecting circuit, a power converter or an inverter, and a power status indicator. (such as light-emitting diodes), as well as any other component associated with the generation, management, and distribution of electrical energy from electronic devices.
  • the electronic device shown in FIG. 2 realizes the control of the target rate of the video stream by the target rate control method shown in this embodiment.
  • the target rate control is an important part of the video communication system. It is used to adapt the bit rate generated by the encoder to the channel, and to improve the quality of the encoded image.
  • the specific implementation process of the target rate control method provided by the embodiment of the present invention is described in detail below with reference to FIG. 3:
  • Step 301 Receive a video stream.
  • the electronic device shown in this embodiment can acquire a video stream, and the video stream shown in this embodiment adopts a Hierarchical encoding method.
  • the video stream shown in this embodiment adopts a target layer coding structure.
  • the video stream received by the electronic device is exemplified by using a three-layer coding structure, that is, the N is equal to 3. . It is to be understood that in practical applications, more or less coding structures relative to embodiments of the present invention may be employed.
  • Step 302 Obtain a pre-control target code rate of the current frame in the video stream.
  • the current frame shown in this embodiment is an inter prediction frame in the video stream.
  • the electronic device calculates a pre-control target bit rate of the current frame
  • the specific method is not limited, that is, the electronic device shown in this embodiment may use any target rate control algorithm to calculate the pre-control target code rate of the current frame.
  • the target rate control algorithm may be a TMN8 algorithm and a TMN5 algorithm of H.263, a JVT algorithm, and the like.
  • Step 303 Set the current frame to be an intra prediction frame, and then downsample the current frame to obtain first target data.
  • the current frame is the intra predicted frame, only intra prediction is used for the current frame.
  • Step 304 Perform fast coding on the first target data to obtain a first prediction residual.
  • the fast coding is a simplified coding, which can reduce the number of mode selections and reduce the number of motion searches.
  • Step 305 Set the current frame to be an inter prediction frame, and then downsample the current frame to obtain second target data.
  • intra prediction and inter prediction may be employed for the current frame.
  • Step 306 Perform fast coding on the second target data to obtain a second prediction residual.
  • Step 303 and step 304 and step 305 and step 306 shown in this embodiment are not limited in the execution timing.
  • Step 307 Obtain a target parameter by using a target formula.
  • the electronic device shown in this embodiment calculates the target parameter IPcost according to the target formula.
  • the target formula is The Icost is a first prediction residual when the current frame is an intra prediction frame, and the Pcost is a second prediction residual when the current frame is an inter prediction frame.
  • the severity of the motion of the video stream is inversely proportional to the magnitude of the target parameter IPcost, that is, if the video stream moves more severely, the target parameter IPcost is smaller, and if the target is at this time
  • the frame is located at layer 0, then layer 0 is assigned a smaller target bit rate. If the target frame is located at layer 1, then layer 1 is assigned a smaller target bit rate. If the target frame is located at layer 2, then layer2 is Assign a smaller target bit rate.
  • the target parameter IPcost is larger. If the target frame is located at layer 0, then layer 0 allocates a larger target bit rate, if the target frame Located in layer 1, layer 1 allocates a larger target bit rate, and if the target frame is in layer 2, layer 2 allocates a larger target bit rate.
  • Step 308 Create the target correspondence list.
  • the step 308 shown in this embodiment is an optional step, that is, if the electronic device shown in this embodiment has created the target correspondence relationship list, the step 308 shown in this embodiment is not required to be performed in the specific application. If the electronic device has not created the target correspondence list, the electronic device needs to perform step 308 shown in this embodiment to implement the target correspondence list creation process.
  • the target correspondence relationship list that has been created includes a target layer coding structure, a correspondence relationship between the target parameters and a pre-control target code rate ratio T layer_N .
  • the target layer coding structure is any layer coding structure in the N layer coding structure, that is, in the three layer coding structure provided in this embodiment, the target layer coding structure may be the first layer layer 0, or The second layer layer 1, or the third layer layer 2.
  • the target correspondence relationship list is shown in FIG. 4, and the control on the first layer layer 0 is established in the target correspondence relationship list shown in FIG.
  • the front target code rate ratio T layer — 0 corresponds to the target parameter IP cost.
  • the pre-control target code rate ratio T layer — 0 is equal to 38.
  • the pre-control target The code rate ratio T layer — 0 is equal to 62.
  • the target correspondence relationship list is shown in FIG. 5, and the control on the second layer layer 1 is established in the target correspondence relationship list shown in FIG.
  • the front target code rate ratio T layer-1 corresponds to the target parameter IPcost.
  • the pre-control target code rate ratio T layer-1 is equal to 33.
  • the pre-control target The code rate ratio T layer-1 is equal to 22.
  • the target correspondence relationship list is shown in FIG. 6, and the control on the third layer layer 2 is established in the target correspondence relationship list shown in FIG. before the target bit rate T layer-2 ratio to the target parameter IPcost correspondence.
  • the pre-control target code rate ratio T layer ⁇ 2 is equal to 29, and if the target parameter IPcost is less than 5 and greater than or equal to 4, the pre-control target The code rate ratio T layer — 2 is equal to 16.
  • the specific numerical range of the pre - control target code rate ratio corresponding to the pre - control target code rate ratio T layer-N established by the target correspondence relationship list created in this embodiment is an optional example.
  • the pre-control target code rate ratio corresponding to the pre - control target code rate ratio T layer-N may also adopt other data ranges as long as the target layer is at the level of the target layer coding structure.
  • control target code rate higher T layer-N ratio for example, in a video stream of the scene intense exercise, the lower the control of the first layer before the layer0 target code rate ratio T layer0, a third layer is the target layer encoding Structural control Before the target bit rate T layer-3 ratio higher.
  • Step 309 Acquire, according to the target correspondence relationship list, the pre-control target code rate ratio corresponding to the target layer coding structure and the target parameter.
  • the target correspondence list that has been created in step 308 can be obtained and the target is obtained.
  • Step 310 Allocate the pre-control target code rate ratio for the target layer coding structure.
  • the electronic device allocates the pre-control target code rate ratio T layer_N determined in step 309 to the target layer coding structure.
  • the target code rate ratio before control is determined in step 309 shown in this embodiment.
  • the T layer-0 is 60
  • the electronic device shown in this embodiment can determine that the pre-control target code rate ratio T layer — 0 assigned to the layer 0 is 60.
  • the target code rate ratio before control is determined in step 309 shown in this embodiment.
  • the T layer-1 is 23, and the electronic device shown in this embodiment can determine that the pre-control target code rate ratio T layer-1 assigned to the layer 1 is 23.
  • the target code rate ratio before control is determined in step 309 shown in this embodiment.
  • the T layer-2 is 18, and the electronic device shown in this embodiment can determine that the pre-control target code rate ratio T layer-2 assigned to the layer 2 is 18.
  • Step 311 Obtain a number of remaining frames Num layer_N of the target layer coding structure.
  • the electronic device shown in this embodiment may obtain the number of remaining frames of each layer coding structure in the target layer coding structure provided by this embodiment.
  • the remaining frames shown in this embodiment are the total number of frames in each layer of the coding structure in the target layer coding structure minus the coded frames.
  • the electronic device shown in this embodiment acquires the remaining frame number Num layer_0 in the first layer layer 0 in the target layer coding structure, and the electronic device is in the target layer coding structure.
  • the remaining number of frames Num layer- 1 is obtained in the layer 1 of the second layer, and the electronic device acquires the remaining number of frames Num layer-2 in the layer 2 layer 2 in the target layer coding structure.
  • the step 311 shown in this embodiment may be performed as a current target rate control unit of the electronic device.
  • the current target rate control unit shown in this embodiment may be a GOP (Group of Picture), the GOP is a group of video frames starting with an I frame, and the current target rate control unit is also It can be any set of consecutive frames designed by the target rate control algorithm.
  • GOP Group of Picture
  • the current target rate control unit is also It can be any set of consecutive frames designed by the target rate control algorithm.
  • step 311 is an optional example, and is not limited as long as the step 311 shown in this embodiment can be implemented.
  • Step 312 Acquire a first calculation parameter.
  • the first calculation parameter shown in this embodiment is a product of the first sub-parameter and the second sub-parameter.
  • the first sub-parameter is a sum of the remaining frames Num layer-N of all the target layer coding structures included in the N-layer coding structure.
  • the first sub-parameter shown in this embodiment is Num layer — 0 + Num layer — 1 + Num layer — 2 .
  • the second sub-parameter is a current target code rate ratio T layer — i , wherein the current target code rate ratio T layer — i is a target bit rate allocated by the target layer coding structure in which the current frame is located proportion.
  • the pre-control target code rate ratio T layer — 0 of the current frame can be calculated by using the method in this embodiment.
  • the pre-control target code rate ratio T layer — 0 is the current target code rate ratio T layer — i shown in the step.
  • the pre-control target code rate ratio T layer-1 of the current frame can be calculated by the method shown in this embodiment, and the calculated The pre-control target code rate ratio T layer-1 is the current target code rate ratio T layer — i shown in the step.
  • the pre-control target code rate ratio T layer — 2 of the current frame can be calculated by the method in this embodiment.
  • the pre-control target code rate ratio T layer — 2 is the current target code rate ratio T layer — i shown in the step.
  • Step 313 Obtain a third sub-parameter.
  • a third sub-parameter corresponding to any one of the target layer coding structures included in the N-layer coding structure is obtained.
  • the third sub-parameter is a product of the remaining frame number Num layer_N of the target layer coding structure and the pre-control target code rate ratio T layer-N allocated by the target layer coding structure. .
  • the electronic device shown in this embodiment needs to acquire the third sub-parameter layer by layer.
  • the third sub-parameter is Num layer—0 *T layer—0 .
  • the specific acquisition process of the Num layer—0 and the T layer—0 is described in the above steps. The details are not described in this step.
  • the third sub-parameter is Num layer-1 *T layer-1 , wherein the specific acquisition process of the Num layer-1 and the T layer-1 is detailed in the above steps. The details are not described in this step.
  • the third sub-parameter is Num layer—2 *T layer—2 , and the specific acquisition process of the Num layer-2 and the T layer-2 is detailed in the above steps. The details are not described in this step.
  • Step 314 Obtain a second calculation parameter.
  • the second calculation parameter shown in this embodiment is a sum of all the third sub-parameters corresponding to all the target layer coding structures included in the N-layer coding structure.
  • the third sub-parameter corresponding to the layer 1 of the first layer is Num layer — 0 *T layer — 0
  • the third sub-parameter corresponding to the layer 1 of the second layer is Num layer — 1 * T layer — 1
  • the third sub-parameter corresponding to the third layer layer 2 is Num layer — 2 * T layer — 2 .
  • Step 315 Obtain a controlled target code rate of the current frame after the control.
  • the electronic device shown in this embodiment determines the pre-control target bit rate of the current frame.
  • the product of the target calculation parameter is the control target code rate R i of the controlled current frame.
  • the target calculation parameter is a quotient of the first calculation parameter and the second calculation parameter.
  • the target calculation parameter is:
  • the control target code rate R i of the current frame shown in this embodiment is a control target code rate assigned to the target layer coding structure in which the current frame is located.
  • the pre-control target code rate ratio T layer_N of the different target layer coding structures can be adjusted to obtain the controlled target code rate R of the current frame after the control. i .
  • the method shown in this embodiment is adopted, so that in the Hierarchical structure, different pre-control target code rate ratios between different layers can improve video compression efficiency, and the lower the layer layer, the higher the target code rate before the control is allocated. The higher the layer is, the lower the target code rate before the control is assigned.
  • the inter-frame correlation is high, the low layer layer allocates more pre-control target bit rate, and the low layer layer and the high layer layer control the target bit rate difference before, and For some images with intense motion, the inter-frame correlation is poor, and the pre-control target bit rate difference between the low layer layer and the high layer layer is small.
  • the method shown in this embodiment can allocate the controlled target bit rate of different levels of frames according to the video characteristics of the video stream, thereby improving the video compression efficiency, and particularly improving the subjective quality of the high layer frame of the motion scene.
  • the method shown in this embodiment can be combined with any IPPP structure target rate allocation algorithm. That is to say, the target rate control algorithm of any IPPP can be used to control the target bit rate of different layers by using the method shown in the embodiment of the present invention if it is to be applied to the HPP structure.
  • the IPPP is a hierarchical coding structure
  • the HPP is a hierarchical coding structure.
  • FIG. 8 The example shown in FIG. 8 is applied to the WeChat video chat scenario as an example.
  • the specific application scenario is not limited in this application.
  • the processor of the electronic device may first preset the target correspondence relationship list, so that the processor does not need to perform the process of establishing the target correspondence list in the process of performing video chat through WeChat. , thereby improving the efficiency of controlling the target bit rate.
  • the target correspondence relationship list created by the processor includes a mapping relationship between a target layer coding structure, a target parameter, and a pre-control target code rate ratio T layer-N , where the application scenario is related to the target correspondence relationship list.
  • the application scenario is related to the target correspondence relationship list.
  • the ratio of the pre-control target code rate ratio T layer_N is higher. Just fine.
  • the target layer coding structure includes the first layer layer 0, the second layer layer 1 and the third layer layer. 2 as an example, the control of the first layer before the lower layer 0 of the target code rate ratio T layer-0, the front control target code rate higher proportion of T layer-3 coding target layer structure of a third layer.
  • the application scenario can execute the process shown in FIG. 8:
  • Step 801 The camera collects and acquires a video stream.
  • Step 802 The processor acquires the video stream.
  • This application scenario is exemplified by taking a three-layer coding structure as a video stream.
  • the processor of the electronic device can call the camera of the electronic device to acquire the video stream.
  • Step 803 The processor acquires a pre-control target code rate of the current frame in the video stream.
  • the processor may determine a current frame in the video stream and control a target code rate of the current frame. Calculation.
  • the current frame is an inter prediction frame in the video stream.
  • Step 804 The processor sets the current frame as an intra prediction frame, and downsamples the current frame to obtain first target data.
  • Step 805 The processor performs fast coding on the first target data to obtain a first prediction residual.
  • Step 806 The processor sets the current frame as an inter prediction frame, and downsamples the current frame to obtain second target data.
  • Step 807 The processor performs fast coding on the second target data to obtain a second prediction residual.
  • Step 808 The processor acquires a target parameter by using a target formula.
  • Step 809 The processor acquires, according to the target correspondence relationship list, the pre-control target code rate ratio corresponding to the target layer coding structure and the target parameter.
  • Step 810 The processor allocates the pre-control target code rate ratio to the target layer coding structure.
  • Step 811 The processor acquires a remaining frame number Num layer_N of the target layer coding structure.
  • Step 812 The processor acquires the first calculation parameter.
  • Step 813 The processor acquires a third sub-parameter.
  • Step 814 The processor acquires a second calculation parameter.
  • Step 815 The processor acquires the controlled target code rate of the current frame after the control.
  • Step 816 The processor controls the image output unit to display the encoded video stream.
  • the processor can control the output unit to display the encoded video stream, and in the WeChat video chat scenario, the processor can achieve precise control of the target code rate after control, and the target code rate is stable after the control. Good sex, able to meet the needs of real-time calls.
  • FIG. 1 The physical structure of the electronic device according to the embodiment of the present invention is described in FIG. 1 .
  • the specific structure of the electronic device shown in the embodiment of the present invention is described in detail below with reference to FIG. 7 .
  • the electronic device includes:
  • a first acquiring unit 701 configured to acquire a target code rate before control
  • the pre-control target code rate is a code rate of a current frame in the video stream, and the current frame is an inter-frame predicted frame in the video stream;
  • the fifth obtaining unit 702 is configured to downsample the current frame to obtain target data.
  • the sixth obtaining unit 703 is configured to: if the current frame is an intra prediction frame, perform fast coding on the target data to obtain the first prediction residual;
  • the seventh obtaining unit 704 is configured to: if the current frame is an inter prediction frame, perform fast coding on the target data to obtain the second prediction residual.
  • the calculating unit 705 is configured to obtain a target parameter IPcost by using a target formula, where the target formula is The Icost is a first prediction residual when the current frame is an intra prediction frame, and the Pcost is a second prediction residual when the current frame is an inter prediction frame.
  • a creating unit 706, configured to create the target correspondence relationship list, where the created target correspondence relationship list includes the target layer coding structure, the target parameter, and the pre-control target code rate ratio T layer-N relationship.
  • the fourth obtaining unit 707 is configured to obtain, according to the target correspondence relationship list, the pre-control target code rate ratio T layer — N corresponding to the target layer coding structure and the target parameter IPcost.
  • the second obtaining unit 708 is configured to obtain a pre-control target code rate ratio T layer — N , where the pre - control target code rate ratio corresponds to a target layer coding structure, and the target layer coding structure is any one of N layer coding structures. a layer coding structure, wherein N is a positive integer greater than or equal to 0;
  • a third obtaining unit 709 configured to use the pre-control target code rate ratio T layer-N to control the target code rate of the current frame Control is performed to obtain the controlled target code rate R i .
  • the third obtaining unit 709 includes:
  • the first obtaining module 7091 is configured to acquire the remaining frame number Num layer_N of the target layer coding structure
  • the second obtaining module 7092 is configured to obtain a first calculation parameter, where the first calculation parameter is a product of a first sub-parameter and a second sub-parameter, and the first sub-parameter is all included in the N-layer coding structure. a sum of the remaining frame numbers Num layer_N of the target layer coding structure, the second sub-parameter is a current target code rate ratio T layer — i , and the current target code rate ratio T layer — i is Determining a target code rate ratio allocated by the target layer coding structure in which the current frame is located;
  • a third obtaining module 7093 configured to acquire a third sub-parameter corresponding to any one of the target layer coding structures included in the N-layer coding structure, where the third sub-parameter is a product of the remaining frame number Num layer_N of the target layer coding structure and the pre-control target code rate ratio T layer_N allocated by the target layer coding structure;
  • a fourth obtaining module 7094 configured to acquire a second computing parameter, where the second calculating parameter is a sum of all the third sub-parameters corresponding to all the target layer encoding structures included in the N-layer encoding structure;
  • a determining module 7095 configured to determine the target code rate before the control
  • the product of the target calculation parameter is the control target code rate R i
  • the target calculation parameter is the quotient of the first calculation parameter and the second calculation parameter.
  • the electronic device shown in this embodiment can perform the method of the rate control shown in FIG. 3 .
  • FIG. 3 refers to FIG. 3 in this embodiment, which is not specifically described in this embodiment.
  • the present application further provides a computer readable storage medium, which stores program instructions, wherein the processor executes the stored program instructions, and the embodiment shown in FIG. 3 is executed, and details are not described herein.
  • the disclosed systems, devices, and methods may be implemented by other implementations.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明实施例公开了一种码率控制的方法、电子设备以及计算机可读存储介质,所述方法包括:获取控制前目标码率Ri̍,获取控制前目标码率比例Tlayer—N,所述控制前目标码率比例与目标层编码结构对应,通过所述控制前目标码率比例Tlayer—N对所述当前帧的控制前目标码率Ri̍进行控制以获取控制后的当前帧的控制后目标码率Ri。采用本实施例所示的方法能够根据视频的特性对不同的所述目标层编码结构分配不同的所述控制前目标码率比例Tlayer—N,从而实现根据视频的特性灵活的对不同的所述目标层编码结构分配不同的当前帧的控制后目标码率Ri,在保障了目标码率控制的准确性以及平稳性的前提下,可以提高视频压缩效率。

Description

一种码率控制的方法、电子设备以及计算机可读存储介质
本申请要求于2017年2月7日提交中国专利局,申请号为201710067825.9,发明名称为“一种目标码率控制的方法以及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及通信技术领域,尤其涉及一种码率控制的方法、电子设备以及计算机可读存储介质。
背景技术
目标码率控制是视频编码的重要技术之一,在视频存储和传输等应用中起着重要的作用。目标码率控制的方式将直接决定视频编码的优劣。
现有技术采用的编码方式为层次编码法Hierarchical encoding method,层次编码结构是一种分层次的视频编码模型,图1所示以I帧和P的三层编码结构为例,所述I帧为帧内预测帧,只采用帧内预测。所述P帧为帧间预测帧,可采用帧内预测和帧间预测,帧P1的帧层次为layer 0,帧P2的帧层次为layer 1,帧P3的帧层次为layer 2,如图1所示每个P帧只有一个参考帧,具体的参考关系请详见图1所示,即P0为P1、P2的被参考帧,P1可被P2参考,P2不可被参考。
在具体目标码率控制的过程中,现有技术只对P0进行目标码率控制,其他layer帧不进行目标码率控制,而是采用最近的P0帧的基于layer的固定值作为量化参数进行编码,可见,采用现有技术所示的目标码率控制方式因为只对P0帧进行目标码率控制,并且,当编码方式大于或等于三层时,非P0帧个数大于P0帧个数,则使得目标码率控制不准确,特别是目标码率平稳性 较差。
发明内容
本发明实施例提供了一种能够提升目标码率控制准确性以及目标码率平稳性的码率控制的方法、电子设备以及计算机可读存储介质。
本发明实施例第一方面提供了一种码率控制的方法,包括:
获取控制前目标码率
Figure PCTCN2018073016-appb-000001
所述控制前目标码率为视频流中当前帧的码率,所述当前帧为所述视频流中的帧间预测帧;
获取控制前目标码率比例T layer—N,所述控制前目标码率比例与目标层编码结构对应,所述目标层编码结构为N层编码结构中的任一层编码结构,所述N为大于或等于0的正整数;
通过所述控制前目标码率比例T layer—N对所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000002
进行控制以获取控制后目标码率R i
本发明实施例第二方面提供了一种电子设备,包括:
第一获取单元,用于获取控制前目标码率
Figure PCTCN2018073016-appb-000003
所述控制前目标码率为视频流中当前帧的码率,所述当前帧为所述视频流中的帧间预测帧;
第二获取单元,用于获取控制前目标码率比例T layer—N,所述控制前目标码率比例与目标层编码结构对应,所述目标层编码结构为N层编码结构中的任一层编码结构,所述N为大于或等于0的正整数;
第三获取单元,用于通过所述控制前目标码率比例T layer—N对所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000004
进行控制以获取控制后目标码率R i
本发明实施例第三方面提供了一种电子设备,包括:
一个或多个处理器、存储器、总线***、以及一个或多个程序,所述处理 器和所述存储器通过所述总线***相连;
其中所述一个或多个程序被存储在所述存储器中,所述一个或多个程序包括指令,所述指令当被所述电子设备执行时使所述电子设备执行如上述第一方面所示的方法。
本发明实施例第四方面提供了一种计算机可读存储介质,存储有程序指令,处理器执行所存储的程序指令时执行如上述第一方面所示的方法。
本发明实施例提供了一种码率控制的方法、电子设备以及计算机可读存储介质,本实施例所示的方法首先计算出视频流中当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000005
并为目标层编码结构分配控制前目标码率比例T layer—N,根据所述控制前目标码率比例T layer—N对所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000006
进行控制以获取控制后目标码率R i。可见,采用本实施例所示能够根据视频的特性对不同的所述目标层编码结构分配不同的所述控制前目标码率比例T layer—N,从而实现根据视频的特性灵活的对不同的所述目标层编码结构分配不同的当前帧的控制后目标码率R i,在保障了目标码率控制的准确性以及平稳性的前提下,能够根据视频流的特性对所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000007
进行修正,通过本实施例所示的方法能够根据视频流的视频特点分配不同层次帧的目标码率,可以提高视频压缩效率。
附图说明
图1为现有技术所提供的三层编码结构的结构示例图;
图2为本发明所提供的电子设备的一种实施例结构示意图;
图3为本发明所提供的码率控制的方法的一种实施例步骤流程图;
图4为本发明所提供的目标对应关系列表的一种实施例示意图;
图5为本发明所提供的目标对应关系列表的另一种实施例示意图;
图6为本发明所提供的目标对应关系列表的另一种实施例示意图;
图7为本发明所提供的电子设备的另一种实施例结构示意图;
图8为本发明所提供的码率控制的方法的另一种实施例步骤流程图。
具体实施方式
本发明实施例提供了一种码率控制的方法,以下首先结合图2所示对能够实现本发明实施例所示的码率控制的方法的电子设备的具体结构进行详细说明:
如图2所示,所述电子设备包括输入单元205、处理器203、输出单元201、通信单元207、存储器204、射频电路208等组件。
这些组件通过一条或多条总线进行通信。本领域技术人员可以理解,图2中示出的电子设备的结构并不构成对本发明的限定,它既可以是总线形结构,也可以是星型结构,还可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
在本发明实施方式中,所述电子设备可以是任何移动或便携式电子设备,包括但不限于智能手机、移动电脑、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、媒体播放器、智能电视等。
所述电子设备包括:
输出单元201,用于输出待显示的图像。
具体的,所述输出单元201包括但不限于影像输出单元2011和声音输出单元2012。
所述影像输出单元2011用于输出文字、图片和/或视频。所述影像输出单 元2011可包括显示面板,例如采用液晶显示器(英文全称:Liquid Crystal Display,英文简称:LCD)、有机发光二极管(英文全称:Organic Light-Emitting Diode,英文简称:OLED)、场发射显示器(英文全称:field emission display,英文简称FED)等形式来配置的显示面板。或者所述影像输出单元2011可以包括反射式显示器,例如电泳式(electrophoretic)显示器,或利用光干涉调变技术(英文全称:Interferometric Modulation of Light)的显示器。
所述影像输出单元2011可以包括单个显示器或不同尺寸的多个显示器。在本发明的具体实施方式中,触摸屏亦可同时作为输出单元201的显示面板。
例如,当触摸屏检测到在其上的触摸或接近的手势操作后,传送给处理器203以确定触摸事件的类型,随后处理器203根据触摸事件的类型在显示面板上提供相应的视觉输出。虽然在图2中,输入单元205与输出单元201是作为两个独立的部件来实现电子设备的输入和输出功能,但是在某些实施例中,可以将触摸屏与显示面板集成一体而实现电子设备的输入和输出功能。例如,所述影像输出单元2011可以显示各种图形化用户接口(英文全称:Graphical User Interface,英文简称GUI)以作为虚拟控制组件,包括但不限于窗口、卷动轴、图标及剪贴簿,以供用户通过触控方式进行操作。
在本发明具体实施方式中,所述影像输出单元2011包括滤波器及放大器,用来将处理器203所输出的视频滤波及放大。声音输出单元2012包括数字模拟转换器,用来将处理器203所输出的音频信号从数字格式转换为模拟格式。
处理器203,用于运行相应的代码,对接收信息进行处理,以生成并输出相应的界面。
具体的,所述处理器203为电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储单元内的软件程序和/或模块,以及调用存储在存储单元内的数据,以执行电子设备的各种功能和/或处理数据。所述处理器203可以由集成电路(英文全称:Integrated Circuit,英文简称:IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。
举例来说,所述处理器203可以仅包括中央处理器(英文全称:Central Processing Unit,英文简称:CPU),也可以是图形处理器(英文全称:Graphics Processing Unit,英文简称:GPU),数字信号处理器(英文全称:Digital Signal Processor,英文简称:DSP)、及通信单元中的控制芯片(例如基带芯片)的组合。在本发明实施方式中,CPU可以是单运算核心,也可以包括多运算核心。
存储器204,用于存储代码和数据,代码供处理器203运行。
具体的,存储器204可用于存储软件程序以及模块,处理器203通过运行存储在存储器204的软件程序以及模块,从而执行电子设备的各种功能应用以及实现数据处理。存储器204主要包括程序存储区和数据存储区,其中,程序存储区可存储操作***、至少一个功能所需的应用程序,比如声音播放程序、图像播放程序等等;数据存储区可存储根据电子设备的使用所创建的数据(比如音频数据、电话本等)等。
在本发明具体实施方式中,存储器204可以包括易失性存储器,例如非挥发性动态随机存取内存(英文全称:Nonvolatile Random Access Memory,英文简称NVRAM)、相变化随机存取内存(英文全称:Phase Change RAM,英文简称PRAM)、磁阻式随机存取内存(英文全称:Magetoresistive RAM,英文 简称MRAM)等,还可以包括非易失性存储器,例如至少一个磁盘存储器件、电子可擦除可编程只读存储器(英文全称:Electrically Erasable Programmable Read-Only Memory,英文简称EEPROM)、闪存器件,例如反或闪存(英文全称:NOR flash memory)或是反及闪存(英文全称:NAND flash memory)。
非易失存储器储存处理器203所执行的操作***及应用程序。所述处理器203从所述非易失存储器加载运行程序与数据到内存并将数字内容储存于大量储存装置中。所述操作***包括用于控制和管理常规***任务,例如内存管理、存储设备控制、电源管理等,以及有助于各种软硬件之间通信的各种组件和/或驱动器。
在本发明实施方式中,所述操作***可以是Google公司的Android***、Apple公司开发的iOS***或Microsoft公司开发的Windows操作***等,或者是Vxworks这类的嵌入式操作***。
所述应用程序包括安装在电子设备上的任何应用,包括但不限于浏览器、电子邮件、即时消息服务、文字处理、键盘虚拟、窗口小部件(Widget)、加密、数字版权管理、语音识别、语音复制、定位(例如由全球定位***提供的功能)、音乐播放等等。
输入单元205,用于实现用户与电子设备的交互和/或信息输入到电子设备中。
例如,所述输入单元205可以接收用户输入的数字或字符信息,以产生与用户设置或功能控制有关的信号输入。在本发明具体实施方式中,输入单元205可以是触摸屏,也可以是其他人机交互界面,例如实体输入键、麦克风等, 还可是其他外部信息撷取装置,例如摄像头等。
本发明实施例所示的触摸屏,可收集用户在其上触摸或接近的操作动作。比如用户使用手指、触笔等任何适合的物体或附件在触摸屏上或接近触摸屏的位置的操作动作,并根据预先设定的程式驱动相应的连接装置。可选的,触摸屏可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸操作,并将检测到的触摸操作转换为电信号,以及将所述电信号传送给触摸控制器;触摸控制器从触摸检测装置上接收所述电信号,并将它转换成触点坐标,再送给所述处理器203。
所述触摸控制器还可以接收处理器203发来的命令并执行。此外,所述触摸屏可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触摸屏。
在本发明的其他实施方式中,所述输入单元205所采用的实体输入键可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。麦克风形式的输入单元205可以收集用户或环境输入的语音并将其转换成电信号形式的、处理器203可执行的命令。
在本发明的其他一些实施方式中,所述输入单元205还可以是各类传感器件,例如霍尔器件,用于侦测电子设备的物理量,例如力、力矩、压力、应力、位置、位移、速度、加速度、角度、角速度、转数、转速以及工作状态发生变化的时间等,转变成电量来进行检测和控制。其他的一些传感器件还可以包括重力感应计、三轴加速计、陀螺仪、电子罗盘、环境光传感器、接近传感器、温度传感器、湿度传感器、压力传感器、心率传感器、指纹识别器等。
通信单元207,用于建立通信信道,使电子设备通过所述通信信道以连接至远程服务器,并从所述远程服务器下媒体数据。所述通信单元207可以包括 无线局域网(英文全称:Wireless Local Area Network,英文简称:wireless LAN)模块、蓝牙模块、基带模块等通信模块,以及所述通信模块对应的射频(英文全称:Radio Frequency,英文简称:RF)电路,用于进行无线局域网络通信、蓝牙通信、红外线通信及/或蜂窝式通信***通信,例如宽带码分多重接入(英文全称:Wideband Code Division Multiple Access,英文简称:W-CDMA)及/或高速下行封包存取(英文全称:High Speed Downlink Packet Access,英文简称HSDPA)。所述通信模块用于控制电子设备中的各组件的通信,并且可以支持直接内存存取。
在本发明的不同实施方式中,所述通信单元207中的各种通信模块一般以集成电路芯片(英文全称:Integrated Circuit Chip)的形式出现,并可进行选择性组合,而不必包括所有通信模块及对应的天线组。例如,所述通信单元207可以仅包括基带芯片、射频芯片以及相应的天线以在一个蜂窝通信***中提供通信功能。经由所述通信单元207建立的无线通信连接,例如无线局域网接入或WCDMA接入,所述电子设备可以连接至蜂窝网(英文全称:Cellular Network)或因特网。在本发明的一些可选实施方式中,所述通信单元207中的通信模块,例如基带模块可以集成到处理器203中,典型的如高通(Qualcomm)公司提供的APQ+MDM系列平台。
射频电路208,用于信息收发或通话过程中接收和发送信号。例如,将基站的下行信息接收后,给处理器203处理;另外,将设计上行的数据发送给基站。通常,所述射频电路208包括用于执行这些功能的公知电路,包括但不限于天线***、射频收发机、一个或多个放大器、调谐器、一个或多个振荡器、数字信号处理器、编解码(Codec)芯片组、用户身份模块(SIM)卡、存储器 等等。此外,射频电路208还可以通过无线通信与网络和其他设备通信。
所述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯***(英文全称:Global System of Mobile communication,英文简称:GSM)、通用分组无线服务(英文全称:General Packet Radio Service,英文简称:GPRS)、码分多址(英文全称:Code Division Multiple Access,英文简称:CDMA)、宽带码分多址(英文全称:Wideband Code Division Multiple Access,英文简称:WCDMA)、高速上行行链路分组接入技术(英文全称:High Speed Uplink Packet Access,英文简称:HSUPA)、长期演进(英文全称:Long Term Evolution,英文简称:LTE)、电子邮件、短消息服务(英文全称:Short Messaging Service,英文简称:SMS)等。
电源209,用于给电子设备的不同部件进行供电以维持其运行。作为一般性理解,所述电源209可以是内置的电池,例如常见的锂离子电池、镍氢电池等,也包括直接向电子设备供电的外接电源,例如AC适配器等。在本发明的一些实施方式中,所述电源209还可以作更为广泛的定义,例如还可以包括电源管理***、充电***、电源故障检测电路、电源转换器或逆变器、电源状态指示器(如发光二极管),以及与电子设备的电能生成、管理及分布相关联的其他任何组件。
基于图2所示的电子设备通过本实施例所示的目标码率控制方法实现对视频流目标码率的控制,在多媒体应用中,目标码率控制是构成视频通信***的一个重要部分,它被用来使得编码器产生的比特率和信道相适应,并尽量提高编码图像的质量,以下结合图3所示对本发明实施例所提供的目标码率控制 方法的具体执行过程进行详细说明:
步骤301、接收视频流。
本实施例所示的电子设备能够获取到视频流,本实施例所示的所述视频流采用的为层次编码法Hierarchical encoding method。
本实施例所示的视频流采用的为目标层编码结构。
为更好的理解本发明实施例所示的目标码率控制方法,则以所述电子设备所接收到的视频流采用的是三层编码结构为例进行示例性说明,即所述N等于3。需明确的是,在实际应用中,可采用相对于本发明实施例更多或更少的编码结构。
步骤302、获取视频流中当前帧的控制前目标码率。
确定所述视频流中的当前帧,并对当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000008
进行计算。
具体的,本实施例所示的当前帧为所述视频流中的帧间预测帧。
本实施例对所述电子设备如何计算所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000009
的具体方法不作限定,即本实施例所示的电子设备可采用任一种目标码率控制算法计算所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000010
例如,所述目标码率控制算法可为H.263的TMN8算法和TMN5算法以及JVT算法等。
步骤303、设定所述当前帧为帧内预测帧,则对所述当前帧进行下采样以获取第一目标数据。
若所述当前帧为所述帧内预测帧,则对于所述当前帧只采用帧内预测。
步骤304、对所述第一目标数据进行快速编码以获取第一预测残差。
其中,所述快速编码是一种简化的编码,可减少模式选择次数、减少运动 搜索次数等计算。
本实施例中,所述第一预测残差越大,则说明当相同图像质量下所需目标码率越高。
步骤305、设定所述当前帧为帧间预测帧,则对所述当前帧进行下采样以获取第二目标数据。
若所述当前帧为所述帧间预测帧,则对于所述当前帧可采用帧内预测和帧间预测。
步骤306、对所述第二目标数据进行快速编码以获取第二预测残差。
本实施例所示的步骤303和步骤304与步骤305和步骤306在执行时序上并没有先后的限定。
步骤307、通过目标公式获取目标参数。
具体的,本实施例所示所述电子设备根据所述目标公式计算出所述目标参数IPcost。
所述目标公式为
Figure PCTCN2018073016-appb-000011
其中,所述Icost为所述当前帧为帧内预测帧时的第一预测残差,所述Pcost为所述当前帧为帧间预测帧时的第二预测残差。
本实施例中,所述视频流的运动剧烈程度与所述目标参数IPcost的大小呈反比,即若所述视频流运动的越剧烈,则所述目标参数IPcost越小,若此时所述目标帧位于layer 0,则layer 0当分配较小的目标码率,若所述目标帧位于layer 1,则layer 1当分配较小的目标码率,若所述目标帧位于layer 2,则layer2当分配较小的目标码率。
同样的,若所述视频流运动的越轻微,则所述目标参数IPcost越大,若此 时所述目标帧位于layer 0,则layer 0当分配较大的目标码率,若所述目标帧位于layer 1,则layer 1当分配较大的目标码率,若所述目标帧位于layer2,则layer2当分配较大的目标码率。
为更好的对各层的目标码率进行控制,则请详见本实施例下述步骤所示如何根据所述目标参数实现对控制前目标码率的控制。
步骤308、创建所述目标对应关系列表。
本实施例所示的步骤308为可选的步骤,即若本实施例所示的电子设备已创建了所述目标对应关系列表,则在具体应用中无需执行本实施例所示的步骤308,若所述电子设备尚未创建所述目标对应关系列表,则所述电子设备需要执行本实施例所示的步骤308从而实现对目标对应关系列表创建过程。
已创建的所述目标对应关系列表包括目标层编码结构、所述目标参数和控制前目标码率比例T layer—N的对应关系。
其中,所述目标层编码结构为N层编码结构中的任一层编码结构,即在本实施例所提供的三层编码结构中,所述目标层编码结构可为第一层layer 0、或第二层layer 1,或第三层layer 2。
以所述目标层编码结构为第一层layer 0为例,所述目标对应关系列表请见图4所示,在图4所示的目标对应关系列表建立了位于第一层layer 0上的控制前目标码率比例T layer—0与所述目标参数IPcost对应关系。
例如,若所述目标参数IPcost小于1.5,则所述控制前目标码率比例T layer—0等于38,又如,若所述目标参数IPcost小于5且大于或等于4,则所述控制前目标码率比例T layer—0等于62。
以所述目标层编码结构为第二层layer 1为例,所述目标对应关系列表请 见图5所示,在图5所示的目标对应关系列表建立了位于第二层layer 1上的控制前目标码率比例T layer—1与所述目标参数IPcost对应关系。
例如,若所述目标参数IPcost小于1.5,则所述控制前目标码率比例T layer—1等于33,又如,若所述目标参数IPcost小于5且大于或等于4,则所述控制前目标码率比例T layer—1等于22。
以所述目标层编码结构为第三层layer 2为例,所述目标对应关系列表请见图6所示,在图6所示的目标对应关系列表建立了位于第三层layer 2上的控制前目标码率比例T layer—2与所述目标参数IPcost对应关系。
例如,若所述目标参数IPcost小于1.5,则所述控制前目标码率比例T layer—2等于29,又如,若所述目标参数IPcost小于5且大于或等于4,则所述控制前目标码率比例T layer—2等于16。
需明确的是,本实施例所创建的所述目标对应关系列表所建立的与所述控制前目标码率比例T layer—N对应的控制前目标码率比例的具体数值范围为可选的示例,在具体应用中,与所述控制前目标码率比例T layer—N对应的控制前目标码率比例也可采用其他数据范围,只要所述当前帧所位于的所述目标层编码结构的层级越小,则所述控制前目标码率比例T layer—N越高,例如,本实施例中,若所述当前帧位于第一层layer 0,则所述控制前目标码率比例T layer—0越高,且本实施例所示的视频流运动的越剧烈,则位于低层级的目标层编码结构的控制前目标码率比例T layer—N越低,位于高层级的目标层编码结构的控制前目标码率比例T layer—N越高,例如,在视频流运动剧烈的场景下,第一层layer0的控制前目标码率比例T layer—0越低,位于第三层的目标层编码结构的控制前目标码率比例T layer—3越高。
步骤309、根据目标对应关系列表获取与所述目标层编码结构和所述目标参数对应的所述控制前目标码率比例。
采用本实施例所示的方法中,若经由本实施例所示的303至步骤307从而计算出所述目标参数IPcost,则可根据步骤308已创建的所述目标对应关系列表获取与所述目标参数IPcost对应的所述控制前目标码率比例T layer—N
需明确的是,采用本实施例所示的方法,每次编码帧间预测帧P帧或帧内预测帧I帧时,需要重新执行本实施例所示的步骤303至步骤307从而计算出所述目标参数,进而通过本实施例所示的步骤309确定出与所述目标参数IPcost对应的所述控制前目标码率比例T layer—N
步骤310、为目标层编码结构分配所述控制前目标码率比例。
本实施例中,所述电子设备将在步骤309所确定的所述控制前目标码率比例T layer—N分配给所述目标层编码结构。
为更好的理解本发明实施例所提供的方法,则结合具体的应用场景对本发明实施例进行详细说明:
若通过本实施例所示的方法,确定出当前帧位于layer 0,且通过步骤307计算出所述目标参数为2.5,则在本实施例所示的步骤309中确定出控制前目标码率比例T layer—0为60,则本实施例所示的电子设备可确定分配给layer 0的所述控制前目标码率比例T layer—0为60。
若通过本实施例所示的方法,确定出当前帧位于layer 1,且通过步骤307计算出所述目标参数为3.5,则在本实施例所示的步骤309中确定出控制前目标码率比例T layer—1为23,则本实施例所示的电子设备可确定分配给layer 1的所述控制前目标码率比例T layer—1为23。
若通过本实施例所示的方法,确定出当前帧位于layer 2,且通过步骤307计算出所述目标参数为2,则在本实施例所示的步骤309中确定出控制前目标码率比例T layer—2为18,则本实施例所示的电子设备可确定分配给layer 2的所述控制前目标码率比例T layer—2为18。
步骤311、获取所述目标层编码结构的剩余帧个数Num layer—N
具体的,本实施例所示的电子设备可逐一获取本实施例所提供的所述目标层编码结构中的每一层编码结构的剩余帧个数。
本实施例所示的剩余帧为所述目标层编码结构中的每一层编码结构中的总帧数减去已编码帧。
更具体的,本实施例所示的电子设备在所述目标层编码结构中的第一层layer 0中获取到剩余帧个数Num layer—0,且所述电子设备在所述目标层编码结构中的第二层layer 1中获取到剩余帧个数Num layer—1,且所述电子设备在所述目标层编码结构中的第三层layer 2中获取到剩余帧个数Num layer—2
可选的,执行本实施例所示的步骤311的可为电子设备的当前目标码率控制单元。
本实施例所示的所述当前目标码率控制单元可为GOP(英文全称:Group of Picture),所述GOP为以I帧起始的一组视频帧,所述当前目标码率控制单元也可以是目标码率控制算法设计的任意一组连续帧。
需明确的是,本实施例对执行步骤311的部件的说明为可选的示例,不作限定,只要能够实现本实施例所示的步骤311即可。
步骤312、获取第一计算参数。
具体的,本实施例所示的所述第一计算参数为第一子参数和第二子参数的 积。
其中,所述第一子参数为所述N层编码结构所包括的所有所述目标层编码结构的所述剩余帧个数Num layer—N的和。
因本实施例以三层编码结构为例,则本实施例所示的所述第一子参数为Num layer—0+Num layer—1+Num layer—2
所述第二子参数为当前目标码率比例T layer—i,其中,所述当前目标码率比例T layer—i为所述当前帧所位于的所述目标层编码结构所分配的目标码率比例。
具体的,若本实施例所示的当前帧位于layer 0,则通过本实施例所示的方法可计算出所述当前帧的所述控制前目标码率比例T layer—0,所计算出的所述控制前目标码率比例T layer—0即为本步骤所示的当前目标码率比例T layer—i
又如,若本实施例所示的当前帧位于layer 1,则通过本实施例所示的方法可计算出所述当前帧的所述控制前目标码率比例T layer—1,所计算出的所述控制前目标码率比例T layer—1即为本步骤所示的当前目标码率比例T layer—i
又如,若本实施例所示的当前帧位于layer 2,则通过本实施例所示的方法可计算出所述当前帧的所述控制前目标码率比例T layer—2,所计算出的所述控制前目标码率比例T layer—2即为本步骤所示的当前目标码率比例T layer—i
因本实施例所示的所述第一计算参数为第一子参数和第二子参数的积,则所述第一计算参数=(Num layer—0+Num layer—1+Num layer—2)*T layer—i
步骤313、获取第三子参数。
具体的,获取与所述N层编码结构所包括的所有所述目标层编码结构中的任一个目标层编码结构对应的第三子参数。
更具体的,所述第三子参数为所述目标层编码结构的剩余帧个数Num layer—N与所述目标层编码结构所分配的所述控制前目标码率比例T layer—N的积。
因本实施例以三层编码结构为例,则本实施例所示的电子设备需要逐层获取所述第三子参数。
在第一层layer 0中,所述第三子参数为Num layer—0*T layer—0,其中,所述Num layer—0和所述T layer—0的具体获取过程请详见上述步骤所示,具体在本步骤中不做赘述。
在第二层layer 1中,所述第三子参数为Num layer—1*T layer—1,其中,所述Num layer—1和所述T layer—1的具体获取过程请详见上述步骤所示,具体在本步骤中不做赘述。
在第三层layer 2中,所述第三子参数为Num layer—2*T layer—2,其中,所述Num layer—2和所述T layer—2的具体获取过程请详见上述步骤所示,具体在本步骤中不做赘述。
步骤314、获取第二计算参数。
具体的,本实施例所示的所述第二计算参数为所述N层编码结构所包括的所有所述目标层编码结构对应的所有所述第三子参数的和。
更具体的,与第一层layer 0对应的第三子参数为Num layer—0*T layer—0,与第二层layer 1对应的第三子参数为Num layer—1*T layer—1,与第三层layer2对应的第三子参数为Num layer—2*T layer—2
本实施例所示的第二计算参数为:
Num layer—0*T layer—0+Num layer—1*T layer—1+Num layer—2*T layer—2
步骤315、获取控制后的当前帧的控制后目标码率。
具体的,本实施例所示的电子设备确定所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000012
和目标计算参数的积为所述控制后的当前帧的控制后目标码率R i
所述目标计算参数为所述第一计算参数与所述第二计算参数的商。
更具体的,所述目标计算参数为:
Figure PCTCN2018073016-appb-000013
可见,本实施例所示的所述控制后的当前帧的控制后目标码率R i为:
Figure PCTCN2018073016-appb-000014
本实施例所示的所述当前帧的控制后目标码率R i为分配给当前帧所位于的目标层编码结构的控制后目标码率。
可见,采用本实施例所示的方法,可以通过所述对不同的目标层编码结构的控制前目标码率比例T layer—N进行调节,从而获取控制后的当前帧的控制后目标码率R i
以下对本实施例所示的方法的有益效果进行说明:
采用本实施例所示的方法,从而使得在Hierarchical结构中,不同layer之间采用不同的控制前目标码率比例可提高视频压缩效率,layer层越低,所分配的控制前目标码率越高,layer层越高,所分配的控制前目标码率越低。
采用本实施例所示的方法,对于静止的图像,帧间相关性高,低layer层分配了更多的控制前目标码率,低layer层和高layer层控制前目标码率差距大,而对于一些运动剧烈的图像,帧间相关性差,低layer层和高layer层之间的控制前目标码率差距较小。通过本实施例所示的方法能够根据视频流 的视频特点分配不同层次帧的控制后目标码率,可以提高视频压缩效率,特别是提高运动场景高layer帧的主观质量。
在应用方面,本实施例所示的方法可以和任意的IPPP结构目标码率分配算法相结合。也就是说,任何一种IPPP的目标码率控制算法,如果想应用于HPP结构,都可以采用本发明实施例所示的方法对不同layer的目标码率进行控制。所述IPPP为无分层次编码结构,HPP为分层次编码结构。
为更好的理解本发明实施例所示的方法,以下结合图8所示说明了本实施例所示的方法在具体应用场景中的实现过程:
图8所示以本实施例所示的方法应用至微信视频聊天场景为例进行示例性说明,本申请对具体的应用场景不做限定。
为提升微信视频聊天场景时提供视频的效果,则电子设备的处理器首先可预设目标对应关系列表,从而使得在通过微信进行视频聊天的过程中,处理器无需执行建立目标对应关系列表的过程,从而提升了对目标码率进行控制的效率。
具体的,所述处理器所创建的所述目标对应关系列表包括目标层编码结构、目标参数和控制前目标码率比例T layer—N的对应关系,本应用场景对所述目标对应关系列表的不做赘述,具体请详见图3所示的实施例,只要所述当前帧所位于的所述目标层编码结构的层级越小,则所述控制前目标码率比例T layer—N越高即可。
可见,若处理器通过电子设备的输入单元(如摄像头)所采集到视频流运动的越剧烈,在所述目标层编码结构包括有第一层layer 0、第二层layer 1以及第三层layer 2为例,则第一层layer 0的控制前目标码率比例T layer—0越 低,位于第三层的目标层编码结构的控制前目标码率比例T layer—3越高。
在所述电子设备的处理器配置完所述目标对应关系列表的情况下,则本应用场景即可执行如图8所示的流程:
步骤801、摄像头采集获取视频流。
步骤802、处理器获取所述视频流。
本应用场景以视频流采用的是三层编码结构为例进行示例性说明。
本应用场景中,在用户需要通过微信进行视频通话时,用户启动微信,从而使得微信运行,进而用户可通过微信输入操作指令以使微信处于视频通话的功能。
在电子设备所安装的微信处于视频通话的功能的情况下,电子设备的处理器即可调用电子设备的摄像头以获取视频流。
步骤803、处理器获取视频流中当前帧的控制前目标码率。
具体的,处理器可确定所述视频流中的当前帧,并对当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000015
进行计算。所述当前帧为所述视频流中的帧间预测帧。
步骤804、处理器设定所述当前帧为帧内预测帧,并对所述当前帧进行下采样以获取第一目标数据。
步骤805、处理器对所述第一目标数据进行快速编码以获取第一预测残差。
步骤806、处理器设定所述当前帧为帧间预测帧,并对所述当前帧进行下采样以获取第二目标数据。
步骤807、处理器对所述第二目标数据进行快速编码以获取第二预测残差。
步骤808、处理器通过目标公式获取目标参数。
步骤809、处理器根据所述目标对应关系列表获取与所述目标层编码结构 和所述目标参数对应的所述控制前目标码率比例。
步骤810、处理器为目标层编码结构分配所述控制前目标码率比例。
步骤811、处理器获取所述目标层编码结构的剩余帧个数Num layer—N
步骤812、处理器获取第一计算参数。
步骤813、处理器获取第三子参数。
步骤814、处理器获取第二计算参数。
步骤815、处理器获取控制后的当前帧的控制后目标码率。
本应用场景所示的步骤801至步骤815的具体执行过程,请详见图3所示的实施例的具体执行过程,具体在本应用场景中不做赘述。
步骤816、处理器控制影像输出单元显示编码后的视频流。
采用本应用场景所示,处理器可控制影响输出单元显示编码后的视频流,且使得在微信视频聊天场景中,处理器能够实现控制后目标码率的精确控制,且控制后目标码率平稳性好,能够满足实时通话的需求。
图1所示对本发明实施例所提供的电子设备的实体结构进行说明,以下结合图7所示从功能模块角度对本发明实施例所示的电子设备的具体结构进行详细说明:
所述电子设备包括:
第一获取单元701,用于获取控制前目标码率
Figure PCTCN2018073016-appb-000016
所述控制前目标码率为视频流中当前帧的码率,所述当前帧为所述视频流中的帧间预测帧;
第五获取单元702,用于对所述当前帧进行下采样以获取目标数据;
第六获取单元703,用于若所述当前帧为帧内预测帧,则对所述目标数据进行快速编码以获取所述第一预测残差;
第七获取单元704,用于若所述当前帧为帧间预测帧,则对所述目标数据进行快速编码以获取所述第二预测残差。
计算单元705,用于通过目标公式获取目标参数IPcost,所述目标公式为
Figure PCTCN2018073016-appb-000017
其中,所述Icost为所述当前帧为帧内预测帧时的第一预测残差,所述Pcost为所述当前帧为帧间预测帧时的第二预测残差;
创建单元706,用于创建所述目标对应关系列表,已创建的所述目标对应关系列表包括所述目标层编码结构、所述目标参数和所述控制前目标码率比例T layer—N的对应关系。
第四获取单元707,用于根据目标对应关系列表获取与所述目标层编码结构和所述目标参数IPcost对应的所述控制前目标码率比例T layer—N
第二获取单元708,用于获取控制前目标码率比例T layer—N,所述控制前目标码率比例与目标层编码结构对应,所述目标层编码结构为N层编码结构中的任一层编码结构,所述N为大于或等于0的正整数;
第三获取单元709,用于通过所述控制前目标码率比例T layer—N对所述当前帧的控制前目标码率
Figure PCTCN2018073016-appb-000018
进行控制以获取控制后目标码率R i
具体的,所述第三获取单元709包括:
第一获取模块7091,用于获取所述目标层编码结构的剩余帧个数Num layer—N
第二获取模块7092,用于获取第一计算参数,所述第一计算参数为第一子参数和第二子参数的积,所述第一子参数为所述N层编码结构所包括的所有所述目标层编码结构的所述剩余帧个数Num layer—N的和,所述第二子参数为当前目标码率比例T layer—i,所述当前目标码率比例T layer—i为所述当前帧所位 于的所述目标层编码结构所分配的目标码率比例;
第三获取模块7093,用于获取与所述N层编码结构所包括的所有所述目标层编码结构中的任一个目标层编码结构对应的第三子参数,所述第三子参数为所述目标层编码结构的剩余帧个数Num layer—N与所述目标层编码结构所分配的所述控制前目标码率比例T layer—N的积;
第四获取模块7094,用于获取第二计算参数,所述第二计算参数为所述N层编码结构所包括的所有所述目标层编码结构对应的所有所述第三子参数的和;
确定模块7095,用于确定所述控制前目标码率
Figure PCTCN2018073016-appb-000019
和目标计算参数的积为所述控制后目标码率R i,所述目标计算参数为所述第一计算参数与所述第二计算参数的商。
本实施例所示的电子设备能够执行图3所示的码率控制的方法,具体执行过程请详见本实施例图3所示,具体在本实施例中不作赘述。
本实施例所示的电子设备在执行码率控制的方法的有益效果的说明请详见本实施例图3所示的实施例,具体在本实施例中不作赘述。
本申请还提供了一种计算机可读存储介质,存储有程序指令,其中,所述处理器执行所存储的程序指令时执行如图3所示的实施例,具体不作赘述。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的***,装置和方法,可以通过其它的实现。例如,以上所描述的装置实施例仅仅是示意性的, 例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (12)

  1. 一种码率控制的方法,其特征在于,包括:
    获取控制前目标码率
    Figure PCTCN2018073016-appb-100001
    所述控制前目标码率为视频流中当前帧的码率,所述当前帧为所述视频流中的帧间预测帧;
    获取控制前目标码率比例T layer-N,所述控制前目标码率比例与目标层编码结构对应,所述目标层编码结构为N层编码结构中的任一层编码结构,所述N为大于或等于0的正整数;
    通过所述控制前目标码率比例T layer-N对所述当前帧的控制前目标码率
    Figure PCTCN2018073016-appb-100002
    进行控制以获取控制后目标码率R i
  2. 根据权利要求1所述的方法,其特征在于,所述获取控制前目标码率比例T layer-N之前,所述方法还包括:
    通过目标公式获取目标参数IPcost,所述目标公式为
    Figure PCTCN2018073016-appb-100003
    其中,所述Icost为所述当前帧为帧内预测帧时的第一预测残差,所述Pcost为所述当前帧为帧间预测帧时的第二预测残差;
    根据目标对应关系列表获取与所述目标层编码结构和所述目标参数IPcost对应的所述控制前目标码率比例T layer-N
  3. 根据权利要求2所述的方法,其特征在于,所述根据目标对应关系列表获取与所述目标层编码结构和所述目标参数IPcost对应的所述控制前目标码率比例之前,所述方法还包括:
    创建所述目标对应关系列表,已创建的所述目标对应关系列表包括所述目标层编码结构、所述目标参数和所述控制前目标码率比例T layer-N的对应关系。
  4. 根据权利要求2或3所述的方法,其特征在于,所述通过目标公式获 取目标参数IPcost之前,所述方法还包括:
    对所述当前帧进行下采样以获取目标数据;
    若所述当前帧为帧内预测帧,则对所述目标数据进行快速编码以获取所述第一预测残差;
    若所述当前帧为帧间预测帧,则对所述目标数据进行快速编码以获取所述第二预测残差。
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述通过所述控制前目标码率比例T layer-N对所述当前帧的控制前目标码率
    Figure PCTCN2018073016-appb-100004
    进行控制以获取控制后目标码率R i包括:
    获取所述目标层编码结构的剩余帧个数Num layer-N
    获取第一计算参数,所述第一计算参数为第一子参数和第二子参数的积,所述第一子参数为所述N层编码结构所包括的所有所述目标层编码结构的所述剩余帧个数Num layer-N的和,所述第二子参数为当前目标码率比例T layer-i,所述当前目标码率比例T layer-i为所述当前帧所位于的所述目标层编码结构所分配的目标码率比例;
    获取与所述N层编码结构所包括的所有所述目标层编码结构中的任一个目标层编码结构对应的第三子参数,所述第三子参数为所述目标层编码结构的剩余帧个数Num layer-N与所述目标层编码结构所分配的所述控制前目标码率比例T layer-N的积;
    获取第二计算参数,所述第二计算参数为所述N层编码结构所包括的所有所述目标层编码结构对应的所有所述第三子参数的和;
    确定所述控制前目标码率
    Figure PCTCN2018073016-appb-100005
    和目标计算参数的积为所述控制后目标码率 R i,所述目标计算参数为所述第一计算参数与所述第二计算参数的商。
  6. 一种电子设备,其特征在于,包括:
    第一获取单元,用于获取控制前目标码率
    Figure PCTCN2018073016-appb-100006
    所述控制前目标码率为视频流中当前帧的码率,所述当前帧为所述视频流中的帧间预测帧;
    第二获取单元,用于获取控制前目标码率比例T layer-N,所述控制前目标码率比例与目标层编码结构对应,所述目标层编码结构为N层编码结构中的任一层编码结构,所述N为大于或等于0的正整数;
    第三获取单元,用于通过所述控制前目标码率比例T layer-N对所述当前帧的控制前目标码率
    Figure PCTCN2018073016-appb-100007
    进行控制以获取控制后目标码率R i
  7. 根据权利要求6所述的电子设备,其特征在于,所述电子设备还包括:
    计算单元,用于通过目标公式获取目标参数IPcost,所述目标公式为
    Figure PCTCN2018073016-appb-100008
    其中,所述Icost为所述当前帧为帧内预测帧时的第一预测残差,所述Pcost为所述当前帧为帧间预测帧时的第二预测残差;
    第四获取单元,用于根据目标对应关系列表获取与所述目标层编码结构和所述目标参数IPcost对应的所述控制前目标码率比例T layer-N
  8. 根据权利要求7所述的电子设备,其特征在于,所述电子设备还包括:
    创建单元,用于创建所述目标对应关系列表,已创建的所述目标对应关系列表包括所述目标层编码结构、所述目标参数和所述控制前目标码率比例T layer-N的对应关系。
  9. 根据权利要求7或8所述的电子设备,其特征在于,所述电子设备还包括:
    第五获取单元,用于对所述当前帧进行下采样以获取目标数据;
    第六获取单元,用于若所述当前帧为帧内预测帧,则对所述目标数据进行快速编码以获取所述第一预测残差;
    第七获取单元,用于若所述当前帧为帧间预测帧,则对所述目标数据进行快速编码以获取所述第二预测残差。
  10. 根据权利要求6至9任一项所述的电子设备,其特征在于,所述第三获取单元包括:
    第一获取模块,用于获取所述目标层编码结构的剩余帧个数Num layer-N
    第二获取模块,用于获取第一计算参数,所述第一计算参数为第一子参数和第二子参数的积,所述第一子参数为所述N层编码结构所包括的所有所述目标层编码结构的所述剩余帧个数Num layer-N的和,所述第二子参数为当前目标码率比例T layer-i,所述当前目标码率比例T layer-i为所述当前帧所位于的所述目标层编码结构所分配的目标码率比例;
    第三获取模块,用于获取与所述N层编码结构所包括的所有所述目标层编码结构中的任一个目标层编码结构对应的第三子参数,所述第三子参数为所述目标层编码结构的剩余帧个数Num layer-N与所述目标层编码结构所分配的所述控制前目标码率比例T layer-N的积;
    第四获取模块,用于获取第二计算参数,所述第二计算参数为所述N层编码结构所包括的所有所述目标层编码结构对应的所有所述第三子参数的和;
    确定模块,用于确定所述控制前目标码率
    Figure PCTCN2018073016-appb-100009
    和目标计算参数的积为所述控制后目标码率R i,所述目标计算参数为所述第一计算参数与所述第二计算参数的商。
  11. 一种电子设备,其特征在于,包括:
    一个或多个处理器、存储器、总线***、以及一个或多个程序,所述处理器和所述存储器通过所述总线***相连;
    其中所述一个或多个程序被存储在所述存储器中,所述一个或多个程序包括指令,所述指令当被所述电子设备执行时使所述电子设备执行如权利要求1至5任一项所述的方法。
  12. 一种计算机可读存储介质,存储有程序指令,其特征在于,处理器执行所存储的程序指令时执行根据权利要求1至5中任一项所述的方法。
PCT/CN2018/073016 2017-02-07 2018-01-17 一种码率控制的方法、电子设备以及计算机可读存储介质 WO2018145561A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710067825.9 2017-02-07
CN201710067825.9A CN108401159B (zh) 2017-02-07 2017-02-07 一种目标码率控制的方法以及电子设备

Publications (1)

Publication Number Publication Date
WO2018145561A1 true WO2018145561A1 (zh) 2018-08-16

Family

ID=63093768

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/073016 WO2018145561A1 (zh) 2017-02-07 2018-01-17 一种码率控制的方法、电子设备以及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN108401159B (zh)
WO (1) WO2018145561A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112291563A (zh) * 2020-10-22 2021-01-29 咪咕视讯科技有限公司 一种视频编码方法、设备及计算机可读存储介质
CN113259673A (zh) * 2021-07-05 2021-08-13 腾讯科技(深圳)有限公司 伸缩性视频编码方法、装置、设备及存储介质
CN113660491A (zh) * 2021-08-10 2021-11-16 杭州网易智企科技有限公司 编码方法、编码装置、存储介质及电子设备
CN113747161A (zh) * 2020-05-29 2021-12-03 北京金山云网络技术有限公司 信息的获取方法和装置、存储介质和电子装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101562741A (zh) * 2009-05-11 2009-10-21 华为技术有限公司 多层编码的码率控制方法及装置
CN101917614A (zh) * 2010-06-03 2010-12-15 北京邮电大学 一种基于h.264分层b帧编码结构的码率控制方法
CN102970540A (zh) * 2012-11-21 2013-03-13 宁波大学 基于关键帧码率-量化模型的多视点视频码率控制方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102123282B (zh) * 2011-03-10 2013-02-27 西安电子科技大学 基于Wyner-Ziv视频编码***的GOP层编码方法
CN102186084B (zh) * 2011-06-07 2013-07-31 东莞电子科技大学电子信息工程研究院 一种可伸缩视频编码svc的空间增强层码率控制实现方法
US10097828B2 (en) * 2014-12-11 2018-10-09 Intel Corporation Rate control for parallel video encoding
CN105872594A (zh) * 2016-03-30 2016-08-17 乐视控股(北京)有限公司 实时码率调节方法、装置及服务端设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101562741A (zh) * 2009-05-11 2009-10-21 华为技术有限公司 多层编码的码率控制方法及装置
CN101917614A (zh) * 2010-06-03 2010-12-15 北京邮电大学 一种基于h.264分层b帧编码结构的码率控制方法
CN102970540A (zh) * 2012-11-21 2013-03-13 宁波大学 基于关键帧码率-量化模型的多视点视频码率控制方法

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113747161A (zh) * 2020-05-29 2021-12-03 北京金山云网络技术有限公司 信息的获取方法和装置、存储介质和电子装置
CN112291563A (zh) * 2020-10-22 2021-01-29 咪咕视讯科技有限公司 一种视频编码方法、设备及计算机可读存储介质
CN113259673A (zh) * 2021-07-05 2021-08-13 腾讯科技(深圳)有限公司 伸缩性视频编码方法、装置、设备及存储介质
CN113259673B (zh) * 2021-07-05 2021-10-15 腾讯科技(深圳)有限公司 伸缩性视频编码方法、装置、设备及存储介质
CN113660491A (zh) * 2021-08-10 2021-11-16 杭州网易智企科技有限公司 编码方法、编码装置、存储介质及电子设备
CN113660491B (zh) * 2021-08-10 2024-05-07 杭州网易智企科技有限公司 编码方法、编码装置、存储介质及电子设备

Also Published As

Publication number Publication date
CN108401159A (zh) 2018-08-14
CN108401159B (zh) 2022-07-08

Similar Documents

Publication Publication Date Title
US10802708B2 (en) Method and apparatus for supporting communication in electronic device
US20220269351A1 (en) Air Gesture-Based Interaction Method and Electronic Device
US11431951B2 (en) Method for displaying dynamic image and terminal
US8605048B2 (en) Method and apparatus for controlling multimedia contents in realtime fashion
KR101898643B1 (ko) 비디오 인코딩 및 디코딩을 위한 적응형 전달 함수
WO2018145561A1 (zh) 一种码率控制的方法、电子设备以及计算机可读存储介质
RU2677595C2 (ru) Способ и аппаратура для отображения интерфейса приложения и электронное устройство
EP3160150A1 (en) Electronic device and method for executing function using speech recognition thereof
US20150160976A1 (en) Multitasking method and electronic device therefor
US20150177903A1 (en) Method and apparatus for controlling scale resolution in electronic device
CN107870666B (zh) 一种终端控制方法及终端
WO2015035870A1 (zh) 多cpu调度方法及装置
KR102193704B1 (ko) 전자 장치의 락 스크린 디스플레이 방법 및 그 전자 장치
EP3429176B1 (en) Scenario-based sound effect control method and electronic device
AU2013231179B2 (en) Method for controlling camera and mobile device
US10432926B2 (en) Method for transmitting contents and electronic device thereof
WO2019129092A1 (zh) 一种降帧率拍照方法、移动终端及存储介质
US20150103222A1 (en) Method for adjusting preview area and electronic device thereof
US20150066424A1 (en) Electronic device and method for measuring position change
US9781380B2 (en) Method, apparatus and terminal for playing multimedia content
CN109144723B (zh) 一种分配存储空间的方法和终端
WO2019071600A1 (zh) 一种图像处理方法及装置
CN105513098B (zh) 一种图像处理的方法和装置
KR20150044225A (ko) 파일 관리 방법 및 그 전자 장치
US20150169129A1 (en) Method of displaying touch indicator and electronic device thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18751764

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18751764

Country of ref document: EP

Kind code of ref document: A1