forked from len0rd/rockbox
Move encoder CPU boost control to the core. Allow CPU to sleep a bit when PCM buffer is empty and save some power. Codec API becomes incompatible so full updates! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15854 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b0dd9eb5bc
commit
5323fe996b
8 changed files with 20 additions and 165 deletions
|
|
@ -291,9 +291,6 @@ static bool init_encoder(void)
|
|||
ci->enc_set_parameters == NULL ||
|
||||
ci->enc_get_chunk == NULL ||
|
||||
ci->enc_finish_chunk == NULL ||
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
ci->enc_pcm_buf_near_empty == NULL ||
|
||||
#endif
|
||||
ci->enc_get_pcm_data == NULL )
|
||||
return false;
|
||||
|
||||
|
|
@ -321,10 +318,6 @@ static bool init_encoder(void)
|
|||
/* main codec entry point */
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
bool cpu_boosted;
|
||||
#endif
|
||||
|
||||
if (!init_encoder())
|
||||
{
|
||||
ci->enc_codec_loaded = -1;
|
||||
|
|
@ -334,11 +327,6 @@ enum codec_status codec_main(void)
|
|||
/* main application waits for this flag during encoder loading */
|
||||
ci->enc_codec_loaded = 1;
|
||||
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
ci->cpu_boost(true);
|
||||
cpu_boosted = true;
|
||||
#endif
|
||||
|
||||
/* main encoding loop */
|
||||
while(!ci->stop_encoder)
|
||||
{
|
||||
|
|
@ -351,13 +339,6 @@ enum codec_status codec_main(void)
|
|||
if (ci->stop_encoder)
|
||||
break;
|
||||
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
|
||||
{
|
||||
ci->cpu_boost(true);
|
||||
cpu_boosted = true;
|
||||
}
|
||||
#endif
|
||||
chunk = ci->enc_get_chunk();
|
||||
chunk->enc_size = enc_size;
|
||||
chunk->num_pcm = PCM_SAMP_PER_CHUNK;
|
||||
|
|
@ -369,21 +350,9 @@ enum codec_status codec_main(void)
|
|||
ci->yield();
|
||||
}
|
||||
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
if (cpu_boosted && ci->enc_pcm_buf_near_empty() != 0)
|
||||
{
|
||||
ci->cpu_boost(false);
|
||||
cpu_boosted = false;
|
||||
}
|
||||
#endif
|
||||
ci->yield();
|
||||
}
|
||||
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
if (cpu_boosted) /* set initial boost state */
|
||||
ci->cpu_boost(false);
|
||||
#endif
|
||||
|
||||
/* reset parameters to initial state */
|
||||
ci->enc_set_parameters(NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue