Performance tuning

This commit is contained in:
Anatoli Arkhipenko 2024-09-30 23:38:26 -04:00
parent 013b232d3d
commit 87f7216b97
5 changed files with 15 additions and 9 deletions

View file

@ -75,7 +75,7 @@
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-D CAMERA_MODEL_AI_THINKER -D CAMERA_MODEL_AI_THINKER
-D FRAME_SIZE=FRAMESIZE_HVGA -D FRAME_SIZE=FRAMESIZE_VGA
-D FPS=10 -D FPS=10
-D WSINTERVAL=100 -D WSINTERVAL=100
-D MAX_CLIENTS=10 -D MAX_CLIENTS=10
@ -107,7 +107,7 @@
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-D CAMERA_MODEL_AI_THINKER -D CAMERA_MODEL_AI_THINKER
-D FRAME_SIZE=FRAMESIZE_HVGA -D FRAME_SIZE=FRAMESIZE_VGA
-D FPS=10 -D FPS=10
-D WSINTERVAL=100 -D WSINTERVAL=100
-D MAX_CLIENTS=10 -D MAX_CLIENTS=10

View file

@ -111,7 +111,7 @@ void setup()
.pixel_format = PIXFORMAT_JPEG, .pixel_format = PIXFORMAT_JPEG,
.frame_size = FRAME_SIZE, .frame_size = FRAME_SIZE,
.jpeg_quality = JPEG_QUALITY, .jpeg_quality = JPEG_QUALITY,
.fb_count = 1, //2, .fb_count = 2,
.fb_location = CAMERA_FB_IN_DRAM, .fb_location = CAMERA_FB_IN_DRAM,
.grab_mode = CAMERA_GRAB_LATEST, .grab_mode = CAMERA_GRAB_LATEST,
// .sccb_i2c_port = -1 // .sccb_i2c_port = -1

View file

@ -212,8 +212,6 @@ void streamCB(void * pvParameters) {
#if defined (BENCHMARK) #if defined (BENCHMARK)
streamAvg.value(micros()-streamStart); streamAvg.value(micros()-streamStart);
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
streamStart = micros(); streamStart = micros();
#endif #endif
@ -260,7 +258,11 @@ void streamCB(void * pvParameters) {
// Let other tasks run after serving every client // Let other tasks run after serving every client
if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD(); if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD();
#if defined (BENCHMARK) #if defined (BENCHMARK)
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) { if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) {
lastPrint = millis(); lastPrint = millis();
Log.verbose("streamCB: wait avg=%d, stream avg=%d us, frame avg size=%d bytes, fps=%S\n", waitAvg.currentValue(), streamAvg.currentValue(), frameAvg.currentValue(), String(fpsAvg.currentValue())); Log.verbose("streamCB: wait avg=%d, stream avg=%d us, frame avg size=%d bytes, fps=%S\n", waitAvg.currentValue(), streamAvg.currentValue(), frameAvg.currentValue(), String(fpsAvg.currentValue()));

View file

@ -223,8 +223,6 @@ void streamCB(void * pvParameters) {
#if defined (BENCHMARK) #if defined (BENCHMARK)
streamAvg.value(micros()-streamStart); streamAvg.value(micros()-streamStart);
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
#endif #endif
// The frame has been served. Release the semaphore and let other tasks run. // The frame has been served. Release the semaphore and let other tasks run.
@ -245,6 +243,11 @@ void streamCB(void * pvParameters) {
// Let other tasks run after serving every client // Let other tasks run after serving every client
if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD(); if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD();
#if defined (BENCHMARK)
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
#endif
#if defined (BENCHMARK) #if defined (BENCHMARK)
if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) { if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) {
lastPrint = millis(); lastPrint = millis();

View file

@ -253,8 +253,6 @@ void streamCB(void * pvParameters) {
info->frame = frameNumber; info->frame = frameNumber;
#if defined (BENCHMARK) #if defined (BENCHMARK)
streamAvg.value(micros()-streamStart); streamAvg.value(micros()-streamStart);
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
#endif #endif
} }
} }
@ -278,6 +276,9 @@ void streamCB(void * pvParameters) {
if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD(); if ( xTaskDelayUntil(&xLastWakeTime, xFrequency) != pdTRUE ) taskYIELD();
#if defined (BENCHMARK) #if defined (BENCHMARK)
fpsAvg.value(1000.0 / (float) (millis()-lastFrame) );
lastFrame = millis();
if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) { if ( millis() - lastPrint > BENCHMARK_PRINT_INT ) {
lastPrint = millis(); lastPrint = millis();
Log.verbose("streamCB: wait avg=%d, stream avg=%d us, frame avg size=%d bytes, fps=%S\n", waitAvg.currentValue(), streamAvg.currentValue(), frameAvg.currentValue(), String(fpsAvg.currentValue())); Log.verbose("streamCB: wait avg=%d, stream avg=%d us, frame avg size=%d bytes, fps=%S\n", waitAvg.currentValue(), streamAvg.currentValue(), frameAvg.currentValue(), String(fpsAvg.currentValue()));