|
@@ -130,14 +130,8 @@ int video_similarity_detection_start(long id, int force_keyframe,
|
|
|
|
|
|
int len = 0;
|
|
|
if (ctx->log) fprintf(ctx->log, "fingerprintFromFFAVFrame 1\n");
|
|
|
- const char *image_hash = fingerprintFromFFAVFrame(ctx->log, video_frame, &len);
|
|
|
-// char image_hash[64] = {0};
|
|
|
-// if (1) {
|
|
|
-// for (int i = 0; i < 64; ++i) {
|
|
|
-// image_hash[i] = 1;
|
|
|
-// }
|
|
|
-// len = 64;
|
|
|
-// }
|
|
|
+ char image_hash[64] = {0};
|
|
|
+ len = fingerprintFromFFAVFrame(ctx->log, video_frame, image_hash);
|
|
|
if (ctx->log) fprintf(ctx->log, "fingerprintFromFFAVFrame exit \n");
|
|
|
if (len > 64) {
|
|
|
LOGE("size=%d \n", len);
|
|
@@ -147,8 +141,8 @@ int video_similarity_detection_start(long id, int force_keyframe,
|
|
|
model->img_len = len;
|
|
|
|
|
|
if (len > 0) {
|
|
|
- model->image_hash = static_cast<char *>(malloc(sizeof(char) * len+1));
|
|
|
- memset((void *) model->image_hash, '\0', sizeof(char) * len+1);
|
|
|
+ model->image_hash = static_cast<char *>(malloc(sizeof(char) * len + 1));
|
|
|
+ memset((void *) model->image_hash, '\0', sizeof(char) * len + 1);
|
|
|
string append_array;
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
char c = image_hash[i];
|
|
@@ -159,7 +153,7 @@ int video_similarity_detection_start(long id, int force_keyframe,
|
|
|
}
|
|
|
}
|
|
|
append_array.append("\0");
|
|
|
- memcpy((char*)model->image_hash, append_array.c_str(), strlen(append_array.c_str()));
|
|
|
+ memcpy((char *) model->image_hash, append_array.c_str(), strlen(append_array.c_str()));
|
|
|
}
|
|
|
if (video_frame->pts >= endTimeMs && (*lists).size() > 1 && index + 1 < (*lists).size()) {
|
|
|
index++;
|
|
@@ -254,7 +248,7 @@ const char *videoSimilarity2json(VideoSimilarity *videoSimilarity) {
|
|
|
// }
|
|
|
// }
|
|
|
va["imageHash"] = item2->image_hash;
|
|
|
- printf("item2->image_hash address=%p \n",&item2->image_hash);
|
|
|
+// printf("item2->image_hash address=%p \n",&item2->image_hash);
|
|
|
free((void *) item2->image_hash);
|
|
|
item2->image_hash = NULL;
|
|
|
}
|