[go: up one dir, main page]

CN101312519B - Data frame processing method and device - Google Patents

Data frame processing method and device Download PDF

Info

Publication number
CN101312519B
CN101312519B CN2008101161880A CN200810116188A CN101312519B CN 101312519 B CN101312519 B CN 101312519B CN 2008101161880 A CN2008101161880 A CN 2008101161880A CN 200810116188 A CN200810116188 A CN 200810116188A CN 101312519 B CN101312519 B CN 101312519B
Authority
CN
China
Prior art keywords
decoding
data frames
preprocessing
time
sleep
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.)
Expired - Fee Related
Application number
CN2008101161880A
Other languages
Chinese (zh)
Other versions
CN101312519A (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.)
Huawei Device Shenzhen Co Ltd
Original Assignee
Huawei Device 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 Huawei Device Co Ltd filed Critical Huawei Device Co Ltd
Priority to CN2008101161880A priority Critical patent/CN101312519B/en
Publication of CN101312519A publication Critical patent/CN101312519A/en
Application granted granted Critical
Publication of CN101312519B publication Critical patent/CN101312519B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本发明实施例提供一种数据帧处理方法和装置。该方法包括在解码模式时间内占用系统资源,对与N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数;解码模式时间结束后,从解码模式切换到睡眠模式,释放系统资源;在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式。在确保不影响用户视听感受的前提下,在解码模式时间内占用系统资源进行多个数据帧的集中解码处理,然后释放系统资源进入睡眠模式,播放先前预处理的数据帧,并使得CPU及相关器件和外设进入低功耗模式,从而大大降低了系统运行媒体播放器时的动态功耗,延长设备的待机时间,提高了服务质量。

Figure 200810116188

Embodiments of the present invention provide a data frame processing method and device. The method includes occupying system resources within the decoding mode time, preprocessing N data frames, and storing the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum decoding number; the decoding mode After the time is over, switch from decoding mode to sleep mode to release system resources; before the end of sleep mode time, receive a sleep wake-up command and switch from sleep mode to decoding mode. On the premise of ensuring that the user's audio-visual experience is not affected, system resources are occupied during the decoding mode time to perform centralized decoding processing of multiple data frames, and then system resources are released to enter sleep mode to play the previously preprocessed data frames and make the CPU and related Devices and peripherals enter a low-power mode, which greatly reduces the dynamic power consumption of the system when running the media player, prolongs the standby time of the device, and improves the quality of service.

Figure 200810116188

Description

数据帧处理方法和装置 Data frame processing method and device

技术领域technical field

本发明实施例涉及数据处理技术领域,尤其涉及一种数据帧处理方法和装置。The embodiments of the present invention relate to the technical field of data processing, and in particular, to a data frame processing method and device.

背景技术Background technique

随着系统集成技术的不断发展,嵌入式系统的功能日益强大,应用也日益广泛。如今嵌入式系统已经融入人们的生活中,如个人数字助理、音乐手机、MP3/MP4播放器等。随着市场对可移动便携式设备在体积和性能方面要求的不断提升,嵌入式设备小体积、高性能与有限的电池容量之间的矛盾成为亟待解决的问题。With the continuous development of system integration technology, the functions of embedded systems are becoming more and more powerful, and their applications are becoming more and more extensive. Nowadays, embedded systems have been integrated into people's lives, such as personal digital assistants, music phones, MP3/MP4 players, etc. As the market continues to increase the size and performance requirements of mobile portable devices, the contradiction between the small size, high performance and limited battery capacity of embedded devices has become an urgent problem to be solved.

MP3音频播放和MP4视频播放业务,是用户频繁使用的主业务,现有技术便携式终端中媒体播放器是一个基于多任务系统的设计方案,其中主控任务负责捕获和接收,处理前台用户命令,并负责反馈媒体播放器的当前状态;解复用任务负责从文件中读取并解析媒体数据内容,完成音视频媒体数据的提取工作等;解码任务负责根据具体媒体数据的编码任务,对媒体数据进行对应的解码变换及相关的后处理任务;播放(Render)任务负责完成音视频同步工作,并调用音频驱动接口、视频驱动接口,完成音频数据的播放和视频数据的播放工作。MP3 audio playback and MP4 video playback services are the main services frequently used by users. The media player in the prior art portable terminal is a design scheme based on a multi-tasking system, wherein the main control task is responsible for capturing and receiving, and processing front-end user commands. It is also responsible for feeding back the current state of the media player; the demultiplexing task is responsible for reading and parsing the media data content from the file, and completing the extraction of audio and video media data; the decoding task is responsible for encoding the media data according to the encoding task of the specific media data Carry out the corresponding decoding transformation and related post-processing tasks; the Render task is responsible for completing the audio and video synchronization work, and calls the audio driver interface and video driver interface to complete the playback of audio data and video data.

图1为现有媒体播放器数据帧处理流程图,如图1所示,现有媒体播放器系统是一个异步系统,在完成一个数据帧的解复用、解码处理后,直接进行该数据帧的播放,并且在播放前一个数据帧的同时进行下一个数据帧的解复用、解码处理,依此类推,多任务之间并发运行,没有严格的对应关系。Fig. 1 is the flow chart of data frame processing of the existing media player, as shown in Fig. 1, the existing media player system is an asynchronous system, after completing the demultiplexing and decoding processing of a data frame, the data frame is directly processed , and demultiplex and decode the next data frame while playing the previous data frame, and so on, there is no strict correspondence between multiple tasks running concurrently.

图2为现有媒体播放器状态机的对应关系,如图2所示,其中在未启动媒体播放器时处于空闲(IDLE)状态;当接收到启动媒体播放器任务时,完成设备初始化时,进入准备(READY)状态,准备播放音视频媒体文件;当收到用户播放命令时进入解码播放(PLAY)状态,开始连续的媒体数据帧解复用、解码及播放工作;当收到用户暂停命令时进入中断(PAUSE)状态,暂停媒体播放任务。图3为现有媒体播放器媒体功耗消耗示意图,如图3所示,横轴表示持续时间,纵轴表示消耗的功耗,在现有媒体播放器播放时,ml对应于媒体播放器处于的准备(READY)状态,在接收到播放命令后,进入m2对应图中解码播放(PLAY)状态,CPU以全速运行,直到媒体播放器工作完成。Fig. 2 is the corresponding relation of existing media player state machine, as shown in Fig. 2, wherein when not starting media player, be in idle (IDLE) state; When receiving the start media player task, when finishing equipment initialization, Enter the READY state, ready to play audio and video media files; enter the decoding and playing (PLAY) state when receiving the user's play command, and start the continuous media data frame demultiplexing, decoding and playing work; when receiving the user's pause command Enter the interrupt (PAUSE) state, and suspend the media playback task. Fig. 3 is the schematic diagram of consumption of media power consumption of existing media player, as shown in Fig. 3, horizontal axis represents duration, and vertical axis represents the power consumption of consumption, when existing media player plays, ml corresponds to media player being in In the READY state, after receiving the playback command, it enters the decoding and playback (PLAY) state in the m2 corresponding figure, and the CPU runs at full speed until the work of the media player is completed.

发明人在实现本发明的过程中发现:现有媒体播放器播放媒体数据帧频时,要频繁读取媒体文件,文件多存储在SD卡、闪存(Flash)或微硬盘等外设中,造成对外设的频繁访问,性能差并且功耗高;媒体文件的解析、解码等工作会频繁启动,功耗较大;还有在使用动态电压频率调整(DynamicVoltage Frequence Scale;以下简称:DVFS)的设备中,由于对CPU负荷造成了持续快速的变化,会使得CPU频繁进行DVFS切换,花费切换能量和时间。总之现有媒体播放器工作模式将导致设备的能耗较大,影响服务质量。The inventor finds in the process of realizing the present invention: when the existing media player plays the media data frame rate, it will frequently read the media files, and the files are mostly stored in peripherals such as SD cards, flash memory (Flash) or micro-hard disks, resulting in Frequent access to peripherals, poor performance and high power consumption; media file parsing, decoding and other tasks will be frequently started, resulting in high power consumption; there are also devices using Dynamic Voltage Frequency Scale (hereinafter referred to as: DVFS) In this case, due to continuous and rapid changes in the CPU load, the CPU will frequently perform DVFS switching, which consumes switching energy and time. In short, the current working mode of the media player will lead to high energy consumption of the equipment, which will affect the quality of service.

发明内容Contents of the invention

本发明实施例提供一种数据帧处理方法和装置,用以解决现有技术中播放器进行媒体播放时功耗较大等缺陷,实现降低系统运行媒体播放器时的动态功耗,提高服务质量。The embodiment of the present invention provides a data frame processing method and device, which are used to solve the defects of relatively large power consumption when the player performs media playback in the prior art, realize the reduction of dynamic power consumption when the system runs the media player, and improve the quality of service .

本发明实施例提供一种数据帧处理方法,包括:An embodiment of the present invention provides a data frame processing method, including:

在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数,所述最大解码数与播放缓冲区的内存空间大小相适应;Occupy system resources within the decoding mode time, preprocess N data frames, and store the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum number of decodings, and the maximum number of decodings is the same as The size of the memory space of the playback buffer is suitable;

所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;After the decoding mode time is over, switch from the decoding mode to the sleep mode, and release the system resources;

在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式。Before the sleep mode time is over, receive a sleep wakeup command to switch from sleep mode to decoding mode.

本发明实施例提供一种数据帧处理装置,包括:An embodiment of the present invention provides a data frame processing device, including:

解码处理模块,用于在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数,所述最大解码数与播放缓冲区的内存空间大小相适应;The decoding processing module is used to occupy system resources within the decoding mode time, preprocess N data frames, and store the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum decoding number, The maximum number of decodes is adapted to the size of the memory space of the playback buffer;

切换控制模块,用于在所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;A switching control module, configured to switch from the decoding mode to the sleep mode after the decoding mode time ends, and release the system resources;

睡眠控制模块,用于在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式。The sleep control module is configured to receive a sleep wake-up instruction and switch from the sleep mode to the decoding mode before the end of the sleep mode time.

本发明实施例提供的数据帧处理方法和装置,在确保不影响用户视听感受的前提下,在解码模式时间内占用系统资源进行多个数据帧的集中解码处二理,然后释放系统资源进入睡眠模式,播放先前预处理的数据帧,并使得CPU及相关器件和外设进入低功耗模式,从而大大降低了系统运行媒体播放器时的动态功耗,延长设备的待机时间,提高了服务质量。The data frame processing method and device provided by the embodiments of the present invention, under the premise of ensuring that the user's audio-visual experience is not affected, occupy system resources within the time of decoding mode to perform centralized decoding processing of multiple data frames, and then release system resources to go to sleep Mode, play the previously preprocessed data frame, and make the CPU and related devices and peripherals enter the low power consumption mode, thereby greatly reducing the dynamic power consumption when the system runs the media player, prolonging the standby time of the device and improving the quality of service .

附图说明Description of drawings

图1为现有媒体播放器数据帧处理流程图;Fig. 1 is the processing flowchart of existing media player data frame;

图2为现有媒体播放器状态机的对应关系;Fig. 2 is the correspondence relation of existing media player state machine;

图3为现有媒体播放器媒体功耗消耗示意图;FIG. 3 is a schematic diagram of media power consumption of an existing media player;

图4为本发明数据帧处理方法实施例流程图;4 is a flowchart of an embodiment of the data frame processing method of the present invention;

图5为本发明数据帧处理方法实施例中媒体播放器的系统状态机示意图;5 is a schematic diagram of a system state machine of a media player in an embodiment of a data frame processing method of the present invention;

图6为本发明数据帧处理方法实施例中媒体播放器的功耗消耗示意图;6 is a schematic diagram of the power consumption of the media player in the embodiment of the data frame processing method of the present invention;

图7为本发明数据帧处理装置实施例一结构示意图;7 is a schematic structural diagram of Embodiment 1 of the data frame processing device of the present invention;

图8为本发明数据帧处理装置实施例二结构示意图。FIG. 8 is a schematic structural diagram of Embodiment 2 of the data frame processing device of the present invention.

具体实施方式Detailed ways

下面结合附图和具体实施例进一步说明本发明实施例的技术方案。The technical solutions of the embodiments of the present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

本发明实施例在低功耗优化设计中,将系统设计成了一个同步系统,各任务之间保持一种相对严格的同步时间,确保在一个相对固定的时间间隔内,中央处理器(简称CPU)和/或数字信号处理器(Digital Sigal Processor,DSP)集中处理数据密集型的计算任务,并能够进行相对长时间的媒体播放。In the low power consumption optimization design of the embodiment of the present invention, the system is designed as a synchronous system, and a relatively strict synchronous time is maintained between each task to ensure that within a relatively fixed time interval, the central processing unit (CPU for short) ) and/or Digital Signal Processor (Digital Signal Processor, DSP) to concentrate on processing data-intensive computing tasks, and can perform relatively long-term media playback.

图4为本发明数据帧处理方法实施例流程图,如图4所示,该方法包括如下步骤:Fig. 4 is a flow chart of an embodiment of the data frame processing method of the present invention, as shown in Fig. 4, the method includes the following steps:

步骤100,在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数;Step 100, occupying system resources within the decoding mode time, preprocessing N data frames, and storing the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum decoding number;

在媒体播放器进行正常的媒体播放的过程中,将媒体播放器的工作模式分为两种工作状态,一种工作状态是解码模式,另一种工作状态是睡眠模式;进一步地,工作于解码模式下的时间段称为解码模式时间,工作在睡眠模式下的时间段称为睡眠模式时间。其中所谓的解码模式工作状态即为在解码模式时间内,媒体播放器占用系统资源即占用CPU和/或DSP资源和其它相关资源对数据帧进行预处理,所述的预处理过程包括:对于音频或纯视频,包括从文件中解复用、解码处理、后处理,音量调整或者重采样处理等,其中后处理即对于音频包括EQ-均衡调节;对于视频播放,包括去块效应,YUV到RGB转换,旋转或缩放等处理和播放等操作;对于带音频伴音的视频,在上述操作的基础上,还包括音视频同步处理等操作。并将经过预处理的结果信息存入播放缓冲区,以供媒体播放器的播放任务从中获取数据进行媒体信息,例如音频或视频的连续播放。在媒体播放器处于解码模式下时,由于系统资源被占用并且处于高速的运行中,系统处于高功耗工作状态。During the normal media playing process of the media player, the working mode of the media player is divided into two working states, one working state is the decoding mode, and the other working state is the sleep mode; further, it works in the decoding mode. The time period in the mode is called the decoding mode time, and the time period in the sleep mode is called the sleep mode time. Wherein the so-called decoding mode working state is that within the decoding mode time, the media player occupies system resources, that is, CPU and/or DSP resources and other related resources are used to preprocess the data frame, and the preprocessing process includes: for audio Or pure video, including demultiplexing from files, decoding processing, post-processing, volume adjustment or resampling processing, etc., where post-processing includes EQ-balance adjustment for audio; for video playback, including deblocking, YUV to RGB Conversion, rotation or scaling and other processing and playback operations; for videos with audio and sound, on the basis of the above operations, operations such as audio and video synchronization processing are also included. And the preprocessed result information is stored in the playback buffer, so that the playback task of the media player can obtain data therefrom for media information, such as continuous playback of audio or video. When the media player is in the decoding mode, the system is in a high power consumption state because system resources are occupied and running at high speed.

媒体播放器处于稳态的工作状态下,在解码模式时间内应尽可能进行数量多的数据帧的预处理工作,但预处理的数据帧的数量有一定的限制,即不能大于最大解码数,因此进行预处理的数据帧的个数应大于1,小于等于最大解码数,该最大解码数应与系统的播放缓冲区的内存空间大小相适应,本方法实施例中以在解码模式时间内对与最大解码数对应的多个数据帧进行预处理为例。When the media player is in a steady state, it should preprocess as many data frames as possible within the decoding mode time, but the number of preprocessed data frames has a certain limit, that is, it cannot be greater than the maximum number of decoding, so The number of preprocessed data frames should be greater than 1 and less than or equal to the maximum number of decodes. This maximum number of decodes should be compatible with the size of the memory space of the play buffer of the system. Take the preprocessing of multiple data frames corresponding to the maximum number of decodes as an example.

步骤101,所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;Step 101, after the decoding mode time is over, switch from the decoding mode to the sleep mode, and release the system resources;

在媒体播放器占用系统资源进行多个数据帧的集中解码处理后,也就是解码模式时间结束后,媒体播放器要从解码模式切换到睡眠模式,当媒体播放器处于睡眠模式时,要释放系统资源即释放对CPU和/或DSP和相关资源的占用,告知CPU和/或DSP暂时不再有解码等处理工作,此时CPU在无其它的处理任务时,便可以进入处于低功耗模式,具体的CPU和/或DSP低功耗模式包括“Clock gating”即CPU和/或DSP关断时钟,由于此时CPU没有时钟,此时的功耗是正常工作的10%以下;CPU和/或DSP低功耗模式还包括“Power Gating”即将CPU和/或DSP进行下电处理,此时没有漏电电流,具体CPU采取的低功耗还要考虑电源分区等其它系统制约因素。After the media player occupies system resources for centralized decoding processing of multiple data frames, that is, after the decoding mode time is over, the media player should switch from the decoding mode to the sleep mode. When the media player is in the sleep mode, the system must be released. The resource is to release the occupation of the CPU and/or DSP and related resources, and inform the CPU and/or DSP that there is no processing work such as decoding for the time being. At this time, the CPU can enter the low power consumption mode when there are no other processing tasks. The specific CPU and/or DSP low power consumption mode includes "Clock gating", that is, the CPU and/or DSP shuts down the clock. Since the CPU has no clock at this time, the power consumption at this time is less than 10% of the normal operation; CPU and/or The DSP low power consumption mode also includes "Power Gating", which is to power off the CPU and/or DSP. At this time, there is no leakage current. The low power consumption of the specific CPU should also consider other system constraints such as power partitions.

在媒体播放器处于睡眠模式时,在睡眠模式时间内媒体播放器不再进行数据帧的解码等处理,而是在播放任务的作用下进行对播放缓冲区内的数据帧预处理结果信息进行连续的播放,并且一直持续到媒体播放器重新切换到解码模式。由于媒体播放器工作在睡眠模式下时,不占用系统资源进行文件数据帧的读取、解复用、解码和同步等预处理操作,因此降低了系统的功耗,节省了设备的电能源。为了延长设备待机时间,可以使得媒体播放器在较长的时间内处于睡眠模式,较短的时间内处于解码模式,也就是说使得睡眠模式时间与解码模式时间的比值越大越好,目的是在保证媒体播放连续的前提下,使媒体播放器在较长一段时间内处于系统功耗较低的睡眠模式,在较短的时间内处于系统功耗较大的解码模式,减少功耗;但由于受到硬件设备及软件处理速度等因素的影响,而且要保证媒体播放的连续性,不影响用户感受,睡眠模式时间和解码模式时间有一定的限定。When the media player is in the sleep mode, the media player no longer performs data frame decoding and other processing during the sleep mode, but performs continuous processing of the data frame preprocessing result information in the playback buffer under the action of the playback task. , and continues until the media player switches back to decoding mode. Since the media player works in the sleep mode, it does not occupy system resources for preprocessing operations such as reading, demultiplexing, decoding and synchronizing file data frames, thus reducing the power consumption of the system and saving the power of the device. In order to prolong the standby time of the device, the media player can be in sleep mode for a long time and in decoding mode for a short time, that is to say, the ratio of sleep mode time to decoding mode time should be as large as possible. Under the premise of ensuring continuous media playback, make the media player in the sleep mode with low system power consumption for a long period of time, and in the decoding mode with high system power consumption in a short period of time to reduce power consumption; but due to Affected by factors such as hardware equipment and software processing speed, and to ensure the continuity of media playback without affecting user experience, there are certain restrictions on sleep mode time and decoding mode time.

具体地,睡眠模式时间的可以设定如下:由于具有媒体播放器功能的终端例如音乐手机、MP3等设备产品设计的制约,播放缓冲区的内存空间是固定的,因此媒体播放器在进行媒体播放时要受到播放缓冲区大小的限制,播放缓冲区中最多能存储多少个数据帧信息是固定的,该最大数值就是前述的最大解码数。睡眠模式时间的最大值就是将播放缓冲区中的、与最大解码数相对应的多个数据帧全部播放完所用的时间。而且播放一种类型的一个数据帧所用的时间是固定的,而且受到播放缓冲区大小的制约的最大解码数也是固定的,那么睡眠模式时间也就是固定的。例如MP3文件每个数据帧的播放时间固定为T1=26ms,具有媒体播放器的设备对应的最大解码数为100个,则睡眠模式时间的最大值为100*26ms即2600ms。解码模式时间的设定如下:由于设备硬件及软件设计好之后,对一种类型的数据帧进行预处理所用的时间称之为帧处理时间T2也就相应固定了,且T2要远小于T1;而且在解码时间内要对最大解码数对应的100个数据帧进行预处理,则解码模式时间的最大值为T2*100。Specifically, the sleep mode time can be set as follows: due to the constraints of the product design of terminals with media player functions such as music phones and MP3 devices, the memory space of the playback buffer is fixed, so the media player is performing media playback. It is limited by the size of the playback buffer, and the maximum number of data frame information that can be stored in the playback buffer is fixed, and the maximum value is the aforementioned maximum decoding number. The maximum value of the sleep mode time is the time it takes to play all the multiple data frames corresponding to the maximum decoding number in the playback buffer. Moreover, the time it takes to play a data frame of one type is fixed, and the maximum decoding number restricted by the size of the playback buffer is also fixed, so the sleep mode time is also fixed. For example, the playback time of each data frame of an MP3 file is fixed at T1=26ms, and the maximum decoding number corresponding to a device with a media player is 100, then the maximum sleep mode time is 100*26ms or 2600ms. The setting of the decoding mode time is as follows: After the equipment hardware and software are designed, the time used to preprocess a type of data frame is called the frame processing time T2, which is correspondingly fixed, and T2 is much smaller than T1; Moreover, 100 data frames corresponding to the maximum decoding number need to be preprocessed within the decoding time, so the maximum decoding mode time is T2*100.

步骤102,在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式。Step 102, before the sleep mode time ends, receive a sleep wake-up instruction, and switch from the sleep mode to the decoding mode.

媒体播放器为保证整个媒体文件的连续播放,应在解码模式和睡眠模式两种工作状态下进行切换,即在睡眠模式时间结束时要进入解码模式时间,切换到解码模式对接下来的数据帧进行解码处理。为了不造成媒体文件播放的中断,要始终保持播放缓冲区内有数据可供播放,因此要在睡眠模式时间结束之前,提前进行解码模式进行数据帧解码,保证在先前存储在播放缓冲区内的数据播放完毕之前将新的解码数据存入播放缓冲区。媒体播放器提前进入解码模式可以由第三方进行呼叫触发,即当媒体播放器从解码模式切换到睡眠模式时,定时器接收所述睡眠模式时间信息;定时器开始计时,并在到达睡眠唤醒时间时发送所述睡眠唤醒指令,所述睡眠唤醒时间小于所述睡眠模式时间,并在睡眠模式时间结束之前,向媒体播放器发送睡眠唤醒指令,由于处理睡眠和唤醒还需要额外的时间开销,因此应进一步保证睡眠唤醒时间与从睡眠模式切换到解码模式所需时间之和小于所述睡眠模式时间,媒体播放器接收到定时器发送的睡眠唤醒指令后从睡眠模式切换到解码模式,重复进行之前所述的对与最大解码数对应的多个数据帧的预处理,并将解码处理结果例如PCM码存储在播放缓冲区内供循环播放。媒体播放器接收到的睡眠唤醒指令也可以是用户操作而产生的所述睡眠唤醒指令,例如用户发起暂停操作,这时CPU首先会被键盘等中断事件所唤醒。媒体播放器接收到的睡眠唤醒指令也可以是其他外部事件而产生的所述睡眠唤醒指令,例如事件提醒到时等。In order to ensure the continuous playback of the entire media file, the media player should switch between the decoding mode and the sleep mode, that is, it will enter the decoding mode when the sleep mode time ends, and switch to the decoding mode to process the next data frame. Decoding processing. In order not to interrupt the playback of media files, there must always be data available for playback in the playback buffer. Therefore, before the end of the sleep mode time, the decoding mode should be performed in advance to decode data frames to ensure that the previously stored data in the playback buffer Store the new decoded data into the playback buffer before the data playback is complete. The early entry of the media player into the decoding mode can be triggered by a call from a third party, that is, when the media player switches from the decoding mode to the sleep mode, the timer receives the time information of the sleep mode; Send the sleep wake-up command when the sleep wake-up time is less than the sleep mode time, and send the sleep wake-up command to the media player before the sleep mode time ends, because processing sleep and wake-up also requires additional time overhead, so It should be further ensured that the sum of the sleep wake-up time and the time required to switch from sleep mode to decoding mode is less than the sleep mode time, and the media player switches from sleep mode to decoding mode after receiving the sleep wake-up command sent by the timer, and repeats before The preprocessing of multiple data frames corresponding to the maximum decoding number is described, and the decoding processing results such as PCM codes are stored in the playback buffer for cyclic playback. The sleep wake-up command received by the media player may also be the sleep wake-up command generated by user operation, for example, the user initiates a pause operation, and at this time, the CPU will first be woken up by an interrupt event such as a keyboard. The sleep wake-up instruction received by the media player may also be the sleep wake-up instruction generated by other external events, such as when an event reminder is due.

在执行完步骤102后,要继续依次执行步骤100和步骤101,也就说整个媒体文件的播放是按照依次执行步骤100,步骤101和步骤102而循环进行的,且循环直至媒体文件播放结束。After executing step 102, continue to execute step 100 and step 101 in sequence, that is to say, the playing of the whole media file is performed in sequence according to step 100, step 101 and step 102, and loops until the media file playback ends.

本实施例提供的数据帧处理方法中,要在进行数据帧的预处理之前,根据所述最大解码数和每一个数据帧的播放时间属性信息,获得所述睡眠模式时间;还要根据所述最大解码数和对每一个数据帧进行解码处理的时间信息,获得所述解码模式时间。In the data frame processing method provided by this embodiment, the sleep mode time should be obtained according to the maximum decoding number and the playback time attribute information of each data frame before the preprocessing of the data frame; The maximum decoding number and the time information of decoding each data frame are used to obtain the decoding mode time.

通过优化媒体播放器的设计方案,在确保不影响用户视听感受的前提下,采用同步的系统设计方法,对于数据处理密集性的任务集中处理,然后再让CPU及相关器件和外设进入低功耗模式,从而大大降低了系统运行媒体播放器时的动态功耗,延长使用时间,提高服务器质量。在保证系统高性能的前提下,有效降低了便携式终端的功耗。由于本发明有效降低媒体播放器使用时的单位功耗,对于同样的功耗指标,因此可以选择标称更低的电池设备,从而进一步降低了设备成本。By optimizing the design of the media player and ensuring that the user's audio-visual experience is not affected, a synchronous system design method is adopted to concentrate on data processing-intensive tasks, and then let the CPU and related devices and peripherals enter low-power Power consumption mode, which greatly reduces the dynamic power consumption of the system when running the media player, prolongs the use time, and improves the quality of the server. On the premise of ensuring the high performance of the system, the power consumption of the portable terminal is effectively reduced. Since the present invention effectively reduces the unit power consumption of the media player, for the same power consumption index, a battery device with a lower nominal value can be selected, thereby further reducing the cost of the device.

在本实施例提供的方法中,在对与最大解码数对应的多个数据帧进行预处理时,可以采用对与最大解码数对应的多个数据帧分批次进行预处理的方式,具体为,将与最大解码数对应的多个数据帧进行分批,占用系统资源在CPU的控制作用下对每批次的数据帧进行预处理。这样避免了因一次性对与最大解码数对应的多个数据帧进行预处理时间较长而带来的时延,而且还可以在从睡眠模式切换到解码模式的过度时间内,迅速补充播放缓冲区内的数据,保证媒体资源播放的连续性。In the method provided in this embodiment, when preprocessing the multiple data frames corresponding to the maximum number of decodings, the method of preprocessing the multiple data frames corresponding to the maximum number of decodings in batches can be used, specifically , divide multiple data frames corresponding to the maximum decoding number into batches, occupy system resources and preprocess each batch of data frames under the control of the CPU. This avoids the delay caused by preprocessing multiple data frames corresponding to the maximum decoding number at one time, and it can also quickly replenish the playback buffer during the transition time from sleep mode to decoding mode. The data in the area ensures the continuity of media resource playback.

还有,在媒体播放器接收到播放指令信息后,若按照稳态情况下的在解码模式时间内对与最大解码数对应的多个数据帧进行预处理,由于数据帧较多将造成延时,在用户发送播放指令后的一段时间内将不能进入播放状态,影响了用户服务质量,因此要在接收到播放指令信息后采取快速启动的模式,使之平稳进入稳定状态,采取快速启动的过程可以是接收播放指令信息,对第一数量的数据帧进行预处理,得到第一数量的数据帧的预处理结果,并将所述第一数量的数据帧的预处理结果存入所述播放缓冲区;在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区,所述第二数量大于所述第一数量;以第二数量作为第一数量,以第三数量作为第二数量,所述第三数量大于所述第二数量,重复执行在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区。具体为,为了保证能够快速启动并且后续播放能连续不间断,开始时刻可先进行N1数据帧媒体(音频视频或音视频数据)的读取和解复用工作,N1的选取可与提前进入解码模式的提前时间相配合,可选择1~4帧;然后就可以进行音视频数据的播放操作,在播放N1数据帧时,根据播放N1数据帧媒体文件特点决定进行N2数据帧的读取和解复用,由于读取和解复用一帧的时间比播放一帧的时间小得多,因此要满足N2>N1,在播放完N1数据帧后,N2数据帧已经准备好,保证了音频数据连续不断的播放;然后进行N3帧数据的读取和解复用,且满足N3>N2;重复进行上述过程,直到最后预处理的数据达到了稳态所要求的解码数据帧个数。媒体播放器对存储在播放缓冲区内的预处理结果一直处于播放状态。In addition, after the media player receives the playback instruction information, if the multiple data frames corresponding to the maximum decoding number are preprocessed according to the decoding mode time in the steady state, the delay will be caused due to the large number of data frames. , it will not be able to enter the playback state for a period of time after the user sends the playback command, which affects the user's service quality. Therefore, after receiving the playback command information, a quick start mode should be adopted to make it enter a stable state smoothly, and a quick start process should be adopted It may be to receive the playback instruction information, preprocess the first number of data frames, obtain the preprocessing results of the first number of data frames, and store the preprocessing results of the first number of data frames into the playback buffer area; when the preprocessing results of the first number of data frames are played, the second number of data frames are preprocessed to obtain the preprocessing results of the second number of data frames, and the second number of The preprocessing result of the data frame is stored in the playback buffer, the second number is greater than the first number; the second number is used as the first number, the third number is used as the second number, and the third number greater than the second number, repeatedly performing preprocessing on the second number of data frames when the preprocessing results of the first number of data frames are played, to obtain the preprocessing results of the second number of data frames , and store the preprocessing results of the second number of data frames into the playback buffer. Specifically, in order to ensure fast startup and continuous and uninterrupted subsequent playback, the reading and demultiplexing of N1 data frame media (audio and video or audio and video data) can be performed first at the beginning, and the selection of N1 can be related to entering the decoding mode in advance Matching the advance time of the N1 data frame, you can choose 1 to 4 frames; then you can play the audio and video data. When playing the N1 data frame, read and demultiplex the N2 data frame according to the characteristics of the N1 data frame media file. , since the time for reading and demultiplexing one frame is much shorter than the time for playing one frame, it is necessary to satisfy N2>N1. After playing the N1 data frame, the N2 data frame is ready to ensure the continuous audio data Play; then read and demultiplex N3 frame data, and satisfy N3>N2; repeat the above process until the final preprocessed data reaches the number of decoded data frames required by the steady state. The media player is always playing the preprocessing result stored in the playback buffer.

通过采用快速启动的方式,媒体播放器可以在接收到播放指令后,在较短的时间内迅速进入媒体文件的播放状态,缩短用户的等待时间,提高用户服务质量。By adopting the quick start mode, the media player can quickly enter the playing state of the media file in a relatively short period of time after receiving the playing instruction, thereby shortening the waiting time of the user and improving the service quality of the user.

图5为本发明数据帧处理方法实施例中媒体播放器的系统状态机示意图,如图5所示,媒体播放器包括如下状态机:Fig. 5 is a schematic diagram of the system state machine of the media player in the embodiment of the data frame processing method of the present invention. As shown in Fig. 5, the media player includes the following state machine:

(1)空闲(IDLE)状态:在未启动媒体播放器时处于空闲状态;(1) Idle (IDLE) state: it is in an idle state when the media player is not started;

(2)准备(READY)状态:当接收到启动媒体播放器任务时,完成设备初始化时,进入准备状态,准备播放音视频媒体文件;(2) Ready (READY) state: When receiving the task of starting the media player, when the device initialization is completed, enter the ready state, ready to play audio and video media files;

(3)解码播放(PLAY)状态:系统连续完成多帧媒体数据的处理;(3) Decoding and playing (PLAY) state: the system continuously completes the processing of multi-frame media data;

(4)快速启动(QUICK START)状态:是一个暂态过程,发生在启动之后和进入解码播放状态之前,目的是防止在开始的阶段一次性进入解码播放状态,将造成用户在等待较长时间后才能获得音视频文件的输出,影响服务质量;(4) Quick start (QUICK START) state: It is a transient process that occurs after starting and before entering the decoding and playing state. The purpose is to prevent the user from entering the decoding and playing state at the beginning, which will cause the user to wait for a long time The output of audio and video files can only be obtained after the audio and video files, which affects the quality of service;

(5)睡眠(SLEEP)状态:可使CPU处于低功耗工作模式,此时不使用的外设,也可以进入低功耗模式;比如说当前媒体播放器采用的视频解码模块是硬件(芯片IP或外部芯片)实现的,那么此对应的硬件也可以进入对应的低功耗模式;本实施例中媒体播放器引入了睡眠状态,用于进行长时间的系统低功耗休息;(5) Sleep (SLEEP) state: the CPU can be placed in a low-power working mode, and the peripherals not in use at this time can also enter the low-power mode; for example, the video decoding module used by the current media player is a hardware (chip IP or external chip), then this corresponding hardware can also enter the corresponding low power consumption mode; in this embodiment, the media player introduces a sleep state, which is used to rest for a long time with low power consumption of the system;

(6)中断(PAUSE)状态:当收到用户暂停命令时进入中断状态,暂停媒体播放任务。(6) Interruption (PAUSE) state: When receiving a pause command from the user, it enters the interruption state and suspends the media playing task.

图6为本发明数据帧处理方法实施例中媒体播放器的功耗消耗示意图,如图6所示,横轴表示持续时间,纵轴表示消耗的功耗,m21和m22表示新的媒体播放器对应的新状态,将媒体播放器正常工作时分为m21(对应PLAY状态)和m22(对应SLEEP状态)两种状态,在m21时,CPU以全速或以对应的速率等级运行,在m22时,系统只进行播放,可以工作在相对较低的功耗模式。Fig. 6 is a schematic diagram of the power consumption of the media player in the embodiment of the data frame processing method of the present invention. As shown in Fig. 6, the horizontal axis represents the duration, the vertical axis represents the consumed power consumption, and m21 and m22 represent new media players Corresponding to the new state, the media player is divided into two states m21 (corresponding to the PLAY state) and m22 (corresponding to the SLEEP state) when the media player is working normally. Play only, can work in a relatively low power consumption mode.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for realizing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the It includes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

图7为本发明数据帧处理装置实施例一结构示意图,如图7所示,该装置包括解码处理模块11、切换控制模块12和睡眠控制模块13,其中解码处理模块11用于在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数;切换控制模块12用于在所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;睡眠控制模块13用于在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式。Fig. 7 is a schematic structural diagram of an embodiment of the data frame processing device of the present invention. As shown in Fig. 7, the device includes a decoding processing module 11, a switching control module 12 and a sleep control module 13, wherein the decoding processing module 11 is used to Occupy system resources within, carry out preprocessing to N data frame, and store the preprocessing result in playing buffer, described N is greater than 1, is less than or equal to the integer of maximum decoding number; Switching control module 12 is used for in described decoding After the mode time ends, switch from the decoding mode to the sleep mode to release the system resources; the sleep control module 13 is used to receive a sleep wake-up instruction before the sleep mode time ends, and switch from the sleep mode to the decoding mode.

具体地,本实施例中所述的数据帧处理装置可以为媒体播放器,当媒体播放器处于媒体文件的播放状态中时,在解码模式时间内,解码处理模块11占用系统资源,在CPU的控制作用下完成多个数据帧的预处理,多个数据帧的数量应大于1个且小于等于最大解码数,并将经过预处理的结果信息存储在播放缓冲区内供播放用,本实施例以对与最大解码数相对应的多个数据帧进行预处理为例进行说明;当解码模式时间结束后,媒体播放器从解码模式切换到睡眠模式,此时释放先前占用的系统资源;媒体播放器进入睡眠模式,对播放缓冲区内的数据进行播放,系统处于低功耗状态;为保证媒体文件播放的持续性,当睡眠模式时间结束之前,睡眠控制模块13要接收睡眠唤醒指令,媒体播放器从睡眠模式切换到解码模式,继续进行多个数据帧的预处理。Specifically, the data frame processing device described in this embodiment can be a media player. When the media player is in the playing state of a media file, the decoding processing module 11 occupies system resources during the decoding mode time. Complete the preprocessing of multiple data frames under control, the number of multiple data frames should be greater than 1 and less than or equal to the maximum decoding number, and store the preprocessed result information in the playback buffer for playback. This embodiment Take the preprocessing of multiple data frames corresponding to the maximum decoding number as an example to illustrate; when the decoding mode time is over, the media player switches from the decoding mode to the sleep mode, and releases the previously occupied system resources at this time; the media player The device enters the sleep mode, and the data in the playback buffer is played, and the system is in a low power consumption state; in order to ensure the continuity of the media file playback, before the sleep mode time ends, the sleep control module 13 will receive the sleep wake-up instruction, and the media playback The processor switches from sleep mode to decoding mode and continues preprocessing of multiple data frames.

本实施例提供的数据帧处理装置,在确保不影响用户视听感受的前提下,在解码模式时间内占用系统资源进行多个数据帧的集中预处理,然后释放系统资源进入睡眠模式,播放先前预处理的数据帧,并使得CPU及相关器件和外设进入低功耗模式,从而大大降低了系统运行媒体播放器时的动态功耗,延长设备的待机时间,提高了服务质量。The data frame processing device provided in this embodiment, on the premise of ensuring that the user's audio-visual experience is not affected, occupies system resources for centralized preprocessing of multiple data frames during the decoding mode time, and then releases system resources to enter sleep mode, playing the previously previewed frame. Processed data frames, and make the CPU and related devices and peripherals enter low power consumption mode, thereby greatly reducing the dynamic power consumption when the system runs the media player, prolonging the standby time of the device, and improving the service quality.

图8为本发明数据帧处理装置实施例二结构示意图,如图8所示,该装置包括上述的解码处理模块11、切换控制模块12和睡眠控制模块13,进一步地,解码处理模块11包括分批控制子模块111和解码处理子模块112,其中分批控制子模块111用于对与所述最大解码数对应的多个数据帧进行分批,控制每批次进行预处理的数据帧的数量;解码处理子模块112用于对每批次的数据帧进行预处理。为了减少时延,并确保媒体文件播放的持续性,解码处理模块11采用分批次对与最大解码数对应的多个数据帧进行预处理的方式,分批控制子模块111控制媒体播放器每次从媒体文件中读取、解复用等操作的数据帧的数量,解码处理子模块112对每批次的数据帧进行预处理;依次类推,进行若干批次的数据帧预处理,便完成对与最大解码数对应的多个数据帧的预处理过程。FIG. 8 is a schematic structural diagram of Embodiment 2 of the data frame processing device of the present invention. As shown in FIG. A batch control submodule 111 and a decoding processing submodule 112, wherein the batch control submodule 111 is used to batch a plurality of data frames corresponding to the maximum decoding number, and control the number of preprocessed data frames per batch ; The decoding processing sub-module 112 is used to preprocess each batch of data frames. In order to reduce the delay and ensure the continuity of the media file playback, the decoding processing module 11 adopts a method of preprocessing a plurality of data frames corresponding to the maximum decoding number in batches, and the batch control submodule 111 controls the media player every The number of data frames read from the media file, demultiplexed, etc., the decoding processing submodule 112 preprocesses each batch of data frames; by analogy, several batches of data frames are preprocessed to complete A preprocessing process for multiple data frames corresponding to the maximum number of decodes.

本数据帧处理装置实施例中还可以包括睡眠模式时间获取模块16和解码模式时间获取模块17,其中睡眠模式时间获取模块16用于根据最大解码数和每一个数据帧的播放时间属性信息,获得睡眠模式时间;解码模式时间获取模块17用于根据最大解码数和对每一个数据帧进行预处理的时间信息,获得解码模式时间。解码处理模块11在解码模式时间获取模块17获得的解码模式时间内进行数据帧的预处理;睡眠控制模块13在睡眠模式时间获取模块16获得的睡眠模式时间内释放系统资源,使CPU处于睡眠状态。This data frame processing device embodiment may also include a sleep mode time acquisition module 16 and a decoding mode time acquisition module 17, wherein the sleep mode time acquisition module 16 is used to obtain Sleep mode time; decoding mode time acquisition module 17 is used to obtain the decoding mode time according to the maximum decoding number and the time information of preprocessing each data frame. The decoding processing module 11 carries out the preprocessing of the data frame within the decoding mode time obtained by the decoding mode time acquisition module 17; the sleep control module 13 releases system resources within the sleep mode time obtained by the sleep mode time acquisition module 16, so that the CPU is in sleep state .

睡眠控制模块13接收的睡眠唤醒指令可以是定时器发送的,也可以因用户付出了新的命令比如说用户发起暂停操作或其他外部事件,而生成睡眠唤醒指令。本实施例中数据帧处理装置还包括定时器14,用于当从解码模式切换到睡眠模式时,接收所述睡眠模式时间信息,开始计时,并在到达睡眠唤醒时间时发送睡眠唤醒指令,所述睡眠唤醒时间与从睡眠模式切换到解码模式所需时间之和小于所述睡眠模式时间。数据帧处理装置还包括播放模块15用于对存储在播放缓冲区内的预处理结果进行播放。定时器14在数据帧处理装置从解码模式切换到睡眠模式时,开始计时,并在临近睡眠模式时间结束之前向数据帧处理装置发送睡眠唤醒指令叫醒数据帧处理装置,占用系统资源进行多个数据帧的预处理过程。数据帧处理装置中的播放模块15在数据帧处理装置进入播放状态后负责从播放缓冲区内调用数据进行媒体信息播放。The sleep wake-up instruction received by the sleep control module 13 may be sent by a timer, or a sleep wake-up instruction may be generated due to a new command given by the user, for example, the user initiates a pause operation or other external events. The data frame processing device in this embodiment also includes a timer 14, which is used to receive the sleep mode time information when switching from the decoding mode to the sleep mode, start timing, and send a sleep wakeup instruction when the sleep wakeup time is reached, so The sum of the sleep wake-up time and the time required to switch from the sleep mode to the decoding mode is less than the sleep mode time. The data frame processing device also includes a playback module 15 for playing the preprocessing result stored in the playback buffer. The timer 14 starts counting when the data frame processing device switches from the decoding mode to the sleep mode, and sends a sleep wake-up instruction to the data frame processing device before the end of the sleep mode time to wake up the data frame processing device, occupying system resources for multiple The preprocessing process of the data frame. The playback module 15 in the data frame processing device is responsible for invoking data from the playback buffer to play media information after the data frame processing device enters the playback state.

进一步地,在媒体播放器接收到播放指令信息后,若按照稳态情况下的在解码模式时间内对与最大解码数对应的多个数据帧进行预处理,由于数据帧较多将造成延时,在用户发送播放指令后的一段时间内将不能进入播放状态,影响了用户服务质量,因此要在接收到播放指令信息后采取快速启动的模式,使之平稳进入稳定状态,本实施例中还可以包括快速启动处理模块18用于完成媒体播放器的快速启动功能。快速启动处理模块18用于接收播放指令信息,对第一数量的数据帧进行预处理,得到第一数量的数据帧的预处理结果,并将所述第一数量的数据帧的预处理结果存入所述播放缓冲区;在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区,所述第二数量大于所述第一数量;以第二数量作为第一数量,以第三数量作为第二数量,所述第三数量大于所述第二数量,重复执行所述在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区。具体为,为了保证能够快速启动并且后续播放能连续不间断,开始时刻可先进行N1数据帧媒体(音频视频或音视频数据)的读取和解复用工作,N1的选取可与提前进入解码模式的提前时间相配合,可选择1~4帧;然后就可以进行音视频数据的播放操作,在播放N1数据帧时,根据播放N1数据帧媒体文件特点决定进行N2数据帧的读取和解复用,由于读取和解复用一帧的时间比播放一帧的时间小得多,因此要满足N2>N1,在播放完N1数据帧后,N2数据帧已经准备好,保证了音频数据连续不断的播放;然后进行N3帧数据的读取和解复用,且满足N3>N2;重复进行上述过程,直到最后预处理的数据达到了稳态所要求的解码数据帧个数。媒体播放器对存储在播放缓冲区内的预处理结果一直处于播放状态。Further, after the media player receives the play instruction information, if the multiple data frames corresponding to the maximum decoding number are preprocessed according to the decoding mode time in the steady state, the delay will be caused due to the large number of data frames , within a certain period of time after the user sends the play instruction, it will not be able to enter the play state, which affects the quality of service for the user. A quick start processing module 18 may be included for completing the quick start function of the media player. The quick start processing module 18 is used to receive the playback instruction information, preprocess the first number of data frames, obtain the preprocessing results of the first number of data frames, and store the preprocessing results of the first number of data frames into the playback buffer; when the preprocessing results of the first number of data frames are played, the second number of data frames are preprocessed to obtain the preprocessing results of the second number of data frames, and The preprocessing results of the second number of data frames are stored in the playback buffer, the second number is greater than the first number; the second number is used as the first number, and the third number is used as the second number, The third number is greater than the second number, and repeatedly performing the preprocessing on the second number of data frames when playing the preprocessing results of the first number of data frames to obtain the second number of Preprocessing results of the data frames, and storing the preprocessing results of the second number of data frames in the playback buffer. Specifically, in order to ensure fast startup and continuous and uninterrupted subsequent playback, the reading and demultiplexing of N1 data frame media (audio and video or audio and video data) can be performed first at the beginning, and the selection of N1 can be related to entering the decoding mode in advance Matching the advance time of the N1 data frame, you can choose 1 to 4 frames; then you can play the audio and video data. When playing the N1 data frame, read and demultiplex the N2 data frame according to the characteristics of the N1 data frame media file. , since the time for reading and demultiplexing one frame is much shorter than the time for playing one frame, it is necessary to satisfy N2>N1. After playing the N1 data frame, the N2 data frame is ready to ensure the continuous audio data Play; then read and demultiplex N3 frame data, and satisfy N3>N2; repeat the above process until the final preprocessed data reaches the number of decoded data frames required by the steady state. The media player is always playing the preprocessing result stored in the playback buffer.

本实施例提供的数据帧处理装置,在确保不影响用户视听感受的前提下,采用同步的系统设计方法,对于数据处理密集性的任务集中处理,然后再让CPU及相关器件和外设进入低功耗模式,从而大大降低了系统运行媒体播放器时的动态功耗,延长使用时间,提高服务质量。The data frame processing device provided in this embodiment adopts a synchronous system design method on the premise of ensuring that the user's audio-visual experience is not affected, and concentrates on data processing-intensive tasks, and then allows the CPU and related devices and peripherals to enter the low Power consumption mode, which greatly reduces the dynamic power consumption when the system runs the media player, prolongs the use time and improves the service quality.

最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims (9)

1.一种数据帧处理方法,其特征在于包括:1. A data frame processing method, characterized in that comprising: 接收播放指令信息,对第一数量的数据帧进行预处理,得到第一数量的数据帧的预处理结果,并将所述第一数量的数据帧的预处理结果存入所述播放缓冲区;Receiving playback instruction information, performing preprocessing on the first number of data frames, obtaining preprocessing results of the first number of data frames, and storing the preprocessing results of the first number of data frames into the playback buffer; 在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区,所述第二数量大于所述第一数量;When playing the preprocessing results of the first number of data frames, preprocessing the second number of data frames to obtain the preprocessing results of the second number of data frames, and storing the second number of data frames The frame preprocessing result is stored in the playback buffer, and the second number is greater than the first number; 以第二数量作为第一数量,以第三数量作为第二数量,所述第三数量大于所述第二数量,重复执行所述在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区;Taking the second number as the first number, taking the third number as the second number, and the third number is greater than the second number, repeating the playing of the preprocessing results of the first number of data frames , preprocessing the second number of data frames to obtain the preprocessing results of the second number of data frames, and storing the preprocessing results of the second number of data frames into the playback buffer; 在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数,所述最大解码数与播放缓冲区的内存空间大小相适应;Occupy system resources within the decoding mode time, preprocess N data frames, and store the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum number of decodings, and the maximum number of decodings is the same as The size of the memory space of the playback buffer is suitable; 所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;After the decoding mode time is over, switch from the decoding mode to the sleep mode, and release the system resources; 在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式;Before the end of the sleep mode time, receive the sleep wake-up command and switch from the sleep mode to the decoding mode; 其中,根据所述最大解码数和每一个数据帧的播放时间属性信息,获得所述睡眠模式时间;Wherein, the sleep mode time is obtained according to the maximum decoding number and the playback time attribute information of each data frame; 根据所述最大解码数和对每一个数据帧进行预处理的时间信息,获得所述解码模式时间。The decoding mode time is obtained according to the maximum number of decodings and time information for preprocessing each data frame. 2.根据权利要求1所述的数据帧处理方法,其特征在于所述对与最大解码数对应的多个数据帧进行预处理包括:2. The data frame processing method according to claim 1, wherein said preprocessing of a plurality of data frames corresponding to the maximum number of decoding comprises: 对与所述最大解码数对应的多个数据帧分批次进行预处理。Perform preprocessing on multiple data frames corresponding to the maximum decoding number in batches. 3.根据权利要求1所述的数据帧处理方法,其特征在于所述接收睡眠唤醒指令包括:3. The data frame processing method according to claim 1, wherein said receiving sleep wake-up instruction comprises: 接收定时器发送的睡眠唤醒指令;或Receive the sleep wake-up command sent by the timer; or 接收因用户操作或其他外部事件而产生的睡眠唤醒指令。Receive sleep wake-up instructions generated by user operations or other external events. 4.根据权利要求3所述的数据帧处理方法,其特征在于所述方法还包括:4. the data frame processing method according to claim 3, is characterized in that described method also comprises: 当从解码模式切换到睡眠模式时,定时器接收所述睡眠模式时间信息;When switching from the decoding mode to the sleep mode, the timer receives the sleep mode time information; 所述定时器开始计时,并在到达睡眠唤醒时间时发送所述睡眠唤醒指令,所述睡眠唤醒时间与从睡眠模式切换到解码模式所需时间之和小于所述睡眠模式时间。The timer starts timing, and sends the sleep wake-up instruction when the sleep wake-up time is reached, and the sum of the sleep wake-up time and the time required for switching from the sleep mode to the decoding mode is less than the sleep mode time. 5.根据权利要求1所述的数据帧处理方法,其特征在于还包括:5. The data frame processing method according to claim 1, further comprising: 对存储在所述播放缓冲区内的所述预处理结果进行播放。and playing the preprocessing result stored in the playing buffer. 6.一种数据帧处理装置,其特征在于包括:6. A data frame processing device, characterized in that comprising: 快速启动处理模块,用于接收播放指令信息,对第一数量的数据帧进行预处理,得到第一数量的数据帧的预处理结果,并将所述第一数量的数据帧的预处理结果存入所述播放缓冲区;在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区,所述第二数量大于所述第一数量;以第二数量作为第一数量,以第三数量作为第二数量,所述第三数量大于所述第二数量,重复执行所述在对所述第一数量的数据帧的预处理结果进行播放时,对第二数量的数据帧进行预处理,得到第二数量的数据帧的预处理结果,并将所述第二数量的数据帧的预处理结果存入所述播放缓冲区;The quick start processing module is used to receive the playback instruction information, preprocess the first number of data frames, obtain the preprocessing results of the first number of data frames, and store the preprocessing results of the first number of data frames into the playback buffer; when the preprocessing results of the first number of data frames are played, the second number of data frames are preprocessed to obtain the preprocessing results of the second number of data frames, and The preprocessing results of the second number of data frames are stored in the playback buffer, the second number is greater than the first number; the second number is used as the first number, and the third number is used as the second number, The third number is greater than the second number, and repeatedly performing the preprocessing on the second number of data frames when playing the preprocessing results of the first number of data frames to obtain the second number of The preprocessing result of the data frame, and storing the preprocessing result of the second number of data frames in the playback buffer; 解码处理模块,用于在解码模式时间内占用系统资源,对N个数据帧进行预处理,并将预处理结果存入播放缓冲区,所述N为大于1,小于等于最大解码数的整数,所述最大解码数与播放缓冲区的内存空间大小相适应;The decoding processing module is used to occupy system resources within the decoding mode time, preprocess N data frames, and store the preprocessing results in the playback buffer, where N is an integer greater than 1 and less than or equal to the maximum decoding number, The maximum number of decodes is adapted to the size of the memory space of the playback buffer; 切换控制模块,用于在所述解码模式时间结束后,从解码模式切换到睡眠模式,释放所述系统资源;A switching control module, configured to switch from the decoding mode to the sleep mode after the decoding mode time ends, and release the system resources; 睡眠控制模块,用于在睡眠模式时间结束之前,接收睡眠唤醒指令,从睡眠模式切换到解码模式;The sleep control module is used to receive a sleep wake-up instruction before the end of the sleep mode time, and switch from the sleep mode to the decoding mode; 睡眠模式时间获取模块,用于根据所述最大解码数和每一个数据帧的播放时间属性信息,获得所述睡眠模式时间;The sleep mode time acquisition module is used to obtain the sleep mode time according to the maximum decoding number and the playback time attribute information of each data frame; 解码模式时间获取模块,用于根据所述最大解码数和对每一个数据帧进行预处理的时间信息,获得所述解码模式时间。The decoding mode time acquisition module is configured to obtain the decoding mode time according to the maximum decoding number and time information for preprocessing each data frame. 7.根据权利要求6所述的数据帧处理装置,其特征在于所述解码处理模块包括:7. The data frame processing device according to claim 6, wherein the decoding processing module comprises: 分批控制子模块,用于对与所述最大解码数对应的多个数据帧进行分批,控制每批次进行预处理的数据帧的数量;The batch control sub-module is used to batch a plurality of data frames corresponding to the maximum decoding number, and control the number of preprocessed data frames in each batch; 解码处理子模块,用于对每批次的数据帧进行预处理。The decoding processing sub-module is used for preprocessing each batch of data frames. 8.根据权利要求6或7所述的数据帧处理装置,其特征在于还包括:8. The data frame processing device according to claim 6 or 7, further comprising: 定时器,用于当从解码模式切换到睡眠模式时,接收所述睡眠模式时间信息,开始计时,并在到达睡眠唤醒时间时发送所述睡眠唤醒指令,所述睡眠唤醒时间与从睡眠模式切换到解码模式所需时间之和小于所述睡眠模式时间。The timer is used to receive the sleep mode time information when switching from the decoding mode to the sleep mode, start counting, and send the sleep wake-up instruction when the sleep wake-up time is reached, and the sleep wake-up time is the same as switching from the sleep mode The sum of the time required to reach the decoding mode is less than the sleep mode time. 9.根据权利要求6所述的数据帧处理装置,其特征在于还包括:9. The data frame processing device according to claim 6, further comprising: 播放模块,用于对存储在所述播放缓冲区内的所述预处理结果进行播放。A playing module, configured to play the preprocessing result stored in the playing buffer.
CN2008101161880A 2008-07-04 2008-07-04 Data frame processing method and device Expired - Fee Related CN101312519B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101161880A CN101312519B (en) 2008-07-04 2008-07-04 Data frame processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101161880A CN101312519B (en) 2008-07-04 2008-07-04 Data frame processing method and device

Publications (2)

Publication Number Publication Date
CN101312519A CN101312519A (en) 2008-11-26
CN101312519B true CN101312519B (en) 2010-07-21

Family

ID=40100917

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101161880A Expired - Fee Related CN101312519B (en) 2008-07-04 2008-07-04 Data frame processing method and device

Country Status (1)

Country Link
CN (1) CN101312519B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101873498B (en) * 2010-06-22 2013-05-08 深圳市融创天下科技股份有限公司 Video decoding method, video decoding device and video/audio play system
CN102307311A (en) * 2011-08-30 2012-01-04 华映光电股份有限公司 Method for playing stereoscopic image
CN102833829B (en) * 2012-08-17 2016-05-25 广州海格天立通信息技术有限公司 Standby wakeup method based on tdma system
CN106095541B (en) * 2016-05-31 2019-11-05 深圳市万普拉斯科技有限公司 Dormancy management method and relevant apparatus
CN107256078B (en) * 2017-05-05 2020-06-23 浙江大华技术股份有限公司 Dynamic voltage frequency adjusting method and device
CN112153447B (en) * 2020-09-27 2022-06-14 海信视像科技股份有限公司 Display device and sound and picture synchronous control method
CN115134658B (en) * 2022-05-27 2024-05-14 阿里巴巴云计算(北京)有限公司 Video processing method, device, equipment and storage medium
CN115579013B (en) * 2022-12-09 2023-03-10 深圳市锦锐科技股份有限公司 Low-power consumption audio decoder

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1675949A (en) * 2002-06-26 2005-09-28 高通股份有限公司 Timer-based sleep for terminals in wireless communication systems
CN1949904A (en) * 2006-10-25 2007-04-18 青岛海信移动通信技术股份有限公司 TD SCDMA music cell phone
JP2007141020A (en) * 2005-11-21 2007-06-07 Seiko Epson Corp Data processing apparatus and electronic device
CN101171564A (en) * 2005-05-11 2008-04-30 英特尔公司 Seamless transition of operating environments in mobile systems for power optimization

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1675949A (en) * 2002-06-26 2005-09-28 高通股份有限公司 Timer-based sleep for terminals in wireless communication systems
CN101171564A (en) * 2005-05-11 2008-04-30 英特尔公司 Seamless transition of operating environments in mobile systems for power optimization
JP2007141020A (en) * 2005-11-21 2007-06-07 Seiko Epson Corp Data processing apparatus and electronic device
CN1949904A (en) * 2006-10-25 2007-04-18 青岛海信移动通信技术股份有限公司 TD SCDMA music cell phone

Also Published As

Publication number Publication date
CN101312519A (en) 2008-11-26

Similar Documents

Publication Publication Date Title
CN101312519B (en) Data frame processing method and device
US9411390B2 (en) Integrated circuit device having power domains and partitions based on use case power optimization
US9632561B2 (en) Power-gating media decoders to reduce power consumption
US8886968B2 (en) Method and device for controlling a dual-processor switch, and terminal associated with the method and device
KR101503627B1 (en) Minimizing resource latency between processor application states in a portable computing device by scheduling resource set transitions
US9338642B2 (en) Method and apparatus for processing application program, and mobile terminal therefor
US20130283076A1 (en) Methods and systems for power management in a data processing system
US20070061600A1 (en) Data processing apparatus, program, recording medium, and content playback apparatus
US20100153761A1 (en) Multiprocessor control unit, control method performed by the same, and integrated circuit
KR20120049604A (en) Method and apparatus for managing memory of a mobile device
GB2457170A (en) Power optimization for an integrated circuit having power domains and power islands
US10564708B2 (en) Opportunistic waking of an application processor
WO2010139169A1 (en) Electricity-saving method and device for terminal
US9632562B2 (en) Systems and methods for reducing volatile memory standby power in a portable computing device
WO2016058386A1 (en) Power consumption management method and device and computer storage medium
US9507641B1 (en) System and method for dynamic granularity control of parallelized work in a portable computing device (PCD)
US20110099404A1 (en) Electronic device, method of controlling an electronic device, and system-on-chip
CN114816026A (en) Low-power-consumption standby method, electronic equipment and computer-readable storage medium
US20120291043A1 (en) Minimizing Resource Latency Between Processor Application States In A Portable Computing Device By Using A Next-Active State Set
CN100518198C (en) Ways to Speed Up Your Phone's Boot Response
TWI467361B (en) Mobile device chip and mobile device controlling method therefor
CN106095055B (en) Application program closing method and device
CN103260224A (en) Mobile terminal and method for achieving refreshing of charging animation during charging
CN116710875A (en) Chip system and control method
CN113672071A (en) Operating system running method and device, storage medium and terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 518129 Building 2, B District, Bantian HUAWEI base, Longgang District, Shenzhen, Guangdong.

Patentee after: Huawei terminal (Shenzhen) Co.,Ltd.

Address before: 518129 Building 2, B District, Bantian HUAWEI base, Longgang District, Shenzhen, Guangdong.

Patentee before: HUAWEI DEVICE Co.,Ltd.

CP01 Change in the name or title of a patent holder
TR01 Transfer of patent right

Effective date of registration: 20181219

Address after: 523808 Southern Factory Building (Phase I) Project B2 Production Plant-5, New Town Avenue, Songshan Lake High-tech Industrial Development Zone, Dongguan City, Guangdong Province

Patentee after: HUAWEI DEVICE Co.,Ltd.

Address before: 518129 Building 2, B District, Bantian HUAWEI base, Longgang District, Shenzhen, Guangdong.

Patentee before: Huawei terminal (Shenzhen) Co.,Ltd.

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100721

CF01 Termination of patent right due to non-payment of annual fee