summaryrefslogtreecommitdiff
path: root/apps/codecs/mp3_enc.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-29 17:52:30 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-29 17:52:30 +0000
commit6ae46065b40691d5571252aeeb2ec5475e2f5e4c (patch)
tree6b53c5593a1b364fe078bfb1f82e2f54ff9b6a96 /apps/codecs/mp3_enc.c
parentb57f23139bbcd3b631d4921e971095694f4a0d56 (diff)
downloadrockbox-6ae46065b40691d5571252aeeb2ec5475e2f5e4c.tar.gz
rockbox-6ae46065b40691d5571252aeeb2ec5475e2f5e4c.zip
Add support for compiling encoders without adjustable CPU frequency and/or IRAM.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11625 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mp3_enc.c')
-rw-r--r--apps/codecs/mp3_enc.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c
index 12a24a7c9b..bbae3502bd 100644
--- a/apps/codecs/mp3_enc.c
+++ b/apps/codecs/mp3_enc.c
@@ -2265,9 +2265,9 @@ static void encode_frame(char *buffer, struct enc_chunk_hdr *chunk)
2265 2265
2266 chunk->enc_size = cfg.byte_per_frame + cfg.mpg.padding; 2266 chunk->enc_size = cfg.byte_per_frame + cfg.mpg.padding;
2267 2267
2268 /* finish this chunk by adding sideinfo header data */ 2268 /* finish this chunk by adding sideinfo header data */
2269 CodedData.bitpos = 0; 2269 CodedData.bitpos = 0;
2270 encodeSideInfo( cfg.cod_info ); 2270 encodeSideInfo( cfg.cod_info );
2271 2271
2272#ifdef ROCKBOX_BIG_ENDIAN 2272#ifdef ROCKBOX_BIG_ENDIAN
2273 /* copy chunk to enc_buffer */ 2273 /* copy chunk to enc_buffer */
@@ -2419,7 +2419,9 @@ static bool enc_init(void)
2419 ci->enc_set_parameters == NULL || 2419 ci->enc_set_parameters == NULL ||
2420 ci->enc_get_chunk == NULL || 2420 ci->enc_get_chunk == NULL ||
2421 ci->enc_finish_chunk == NULL || 2421 ci->enc_finish_chunk == NULL ||
2422#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2422 ci->enc_pcm_buf_near_empty == NULL || 2423 ci->enc_pcm_buf_near_empty == NULL ||
2424#endif
2423 ci->enc_get_pcm_data == NULL || 2425 ci->enc_get_pcm_data == NULL ||
2424 ci->enc_unget_pcm_data == NULL ) 2426 ci->enc_unget_pcm_data == NULL )
2425 return false; 2427 return false;
@@ -2453,7 +2455,9 @@ static bool enc_init(void)
2453 2455
2454enum codec_status codec_main(void) 2456enum codec_status codec_main(void)
2455{ 2457{
2458#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2456 bool cpu_boosted; 2459 bool cpu_boosted;
2460#endif
2457 2461
2458 /* Generic codec initialisation */ 2462 /* Generic codec initialisation */
2459 if (!enc_init()) 2463 if (!enc_init())
@@ -2465,8 +2469,10 @@ enum codec_status codec_main(void)
2465 /* main application waits for this flag during encoder loading */ 2469 /* main application waits for this flag during encoder loading */
2466 ci->enc_codec_loaded = 1; 2470 ci->enc_codec_loaded = 1;
2467 2471
2472#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2468 ci->cpu_boost(true); 2473 ci->cpu_boost(true);
2469 cpu_boosted = true; 2474 cpu_boosted = true;
2475#endif
2470 2476
2471 /* main encoding loop */ 2477 /* main encoding loop */
2472 while (!ci->stop_codec) 2478 while (!ci->stop_codec)
@@ -2480,12 +2486,13 @@ enum codec_status codec_main(void)
2480 if (ci->stop_codec) 2486 if (ci->stop_codec)
2481 break; 2487 break;
2482 2488
2489#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2483 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0) 2490 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
2484 { 2491 {
2485 ci->cpu_boost(true); 2492 ci->cpu_boost(true);
2486 cpu_boosted = true; 2493 cpu_boosted = true;
2487 } 2494 }
2488 2495#endif
2489 chunk = ci->enc_get_chunk(); 2496 chunk = ci->enc_get_chunk();
2490 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk); 2497 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk);
2491 2498
@@ -2502,17 +2509,20 @@ enum codec_status codec_main(void)
2502 ci->yield(); 2509 ci->yield();
2503 } 2510 }
2504 2511
2512#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2505 if (cpu_boosted && ci->enc_pcm_buf_near_empty()) 2513 if (cpu_boosted && ci->enc_pcm_buf_near_empty())
2506 { 2514 {
2507 ci->cpu_boost(false); 2515 ci->cpu_boost(false);
2508 cpu_boosted = false; 2516 cpu_boosted = false;
2509 } 2517 }
2510 2518#endif
2511 ci->yield(); 2519 ci->yield();
2512 } 2520 }
2513 2521
2514 if(cpu_boosted) /* set initial boost state */ 2522#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2523 if (cpu_boosted) /* set initial boost state */
2515 ci->cpu_boost(false); 2524 ci->cpu_boost(false);
2525#endif
2516 2526
2517 /* reset parameters to initial state */ 2527 /* reset parameters to initial state */
2518 ci->enc_set_parameters(NULL); 2528 ci->enc_set_parameters(NULL);