Skip to content

Commit

Permalink
Add new block processing algorithm for performance improved
Browse files Browse the repository at this point in the history
  • Loading branch information
mastervolkov authored and Manouchehri committed Apr 9, 2015
1 parent 0de28ad commit 947e782
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
7 changes: 5 additions & 2 deletions smi2021.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,12 @@ struct smi2021 {

int iso_size;

bool skip_frame;
bool skip_frame_second_field;
bool skip_frame;
bool skip_frame_second_field;

int blk_line_start_recheck;
int blk_line_read;
int to_blk_line_end;
};

/* Provided by smi2021_bootloader.c */
Expand Down
25 changes: 23 additions & 2 deletions smi2021_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,21 @@ static void parse_video(struct smi2021 *smi2021, u8 *p, int size)
}

for (i = 0; i < size; i++) {
if ( smi2021->blk_line_read > 1 ) {
if ( smi2021->to_blk_line_end > ( size - i ) ) {
smi2021->to_blk_line_end = smi2021->to_blk_line_end - ( size - i );
copy_size = size - start_copy;
} else {
copy_size = smi2021->to_blk_line_end;
smi2021->to_blk_line_end = SMI2021_BYTES_PER_LINE;
smi2021->blk_line_read = 0;
}
copy_video_block(smi2021, &(p[start_copy]), copy_size);
i = i + copy_size;
start_copy = i + 1 + 3;
if (i>=size)
continue;
}
switch (smi2021->sync_state) {
case HSYNC:
if (p[i] == 0xff)
Expand All @@ -569,9 +584,11 @@ static void parse_video(struct smi2021 *smi2021, u8 *p, int size)
copy_size = i - 3 - start_copy;
if ( copy_size > 0 ) {
copy_video_block(smi2021, &(p[start_copy]), copy_size);
smi2021->blk_line_read = 0;
}
start_copy = i + 1;
parse_trc(smi2021, p[i]);
smi2021->blk_line_read = smi2021->blk_line_read + 1;
}
}
if ( start_copy < size ) {
Expand Down Expand Up @@ -1070,8 +1087,12 @@ static int smi2021_usb_probe(struct usb_interface *intf,
}

smi2021_initialize(smi2021);
smi2021->skip_frame = false;
smi2021->skip_frame_second_field = false;
smi2021->skip_frame = false;
smi2021->skip_frame_second_field = false;

smi2021->blk_line_start_recheck = 0;
smi2021->blk_line_read = 0;
smi2021->to_blk_line_end = SMI2021_BYTES_PER_LINE;

/* i2c adapter */
smi2021->i2c_adap = adap_template;
Expand Down

0 comments on commit 947e782

Please sign in to comment.