Skip to content

Commit 6587231

Browse files
committed
fix dependency not match with old implementation
1 parent a4ec4c0 commit 6587231

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

dependency.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,13 @@ if we know the roi for the entire GOP, we can pre-calculate the needed mbs at ev
738738
static void compute_mb_mask_from_inter_frame_dependency(int p_videoFileIndex, int _stFrame, int _edFrame, int _stH, int _stW, int _edH, int _edW) {
739739
int l_i, l_j, l_k, l_m;
740740
int l_mbHeight, l_mbWidth;
741-
FILE *tf;
742-
tf = fopen("test1.txt", "w");
741+
//FILE *tf, *tf1;
742+
//tf = fopen("test1.txt", "w");
743+
//tf1 = fopen("test2.txt", "w");
743744
l_mbHeight = (gVideoCodecCtxList[p_videoFileIndex]->height + 15) / 16;
744745
l_mbWidth = (gVideoCodecCtxList[p_videoFileIndex]->width + 15) / 16;
745746
LOGI(10, "start of compute_mb_mask_from_inter_frame_dependency: %d, %d, [%d:%d] (%d, %d) (%d, %d)", _stFrame, _edFrame, l_mbHeight, l_mbWidth, _stH, _stW, _edH, _edW);
747+
//fprintf(tf1, "%d, %d, [%d:%d] (%d, %d) (%d, %d)", _stFrame, _edFrame, l_mbHeight, l_mbWidth, _stH, _stW, _edH, _edW);
746748
memset(interDepMask, 0, sizeof(interDepMask[0][0][0])*MAX_FRAME_NUM_IN_GOP*MAX_MB_H*MAX_MB_W);
747749
//from last frame in the GOP, going backwards to the first frame of the GOP
748750
//1. mark the roi as needed
@@ -757,20 +759,23 @@ static void compute_mb_mask_from_inter_frame_dependency(int p_videoFileIndex, in
757759
//it's not necessary to process _stFrame, as there's no inter-dependency for it
758760
// for (l_i = _edFrame; l_i >= _stFrame; --l_i) {
759761
for (l_i = _edFrame; l_i > _stFrame; --l_i) {
762+
interDepMapMove = interDepMap + (l_i - _stFrame)*l_mbHeight*l_mbWidth*8;
760763
//as we initialize the interDepMask to zero, we don't have a way to tell whether the upper left mb should be decoded, we always mark it as needed
761764
interDepMask[l_i - 1 - _stFrame][0][0] = 1;
762765
for (l_j = 0; l_j < l_mbHeight; ++l_j) {
763766
for (l_k = 0; l_k < l_mbWidth; ++l_k) {
767+
//fprintf(tf, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:\n", l_i, l_j, l_k, *interDepMapMove, *(interDepMapMove+1), *(interDepMapMove+2), *(interDepMapMove+3), *(interDepMapMove+4), *(interDepMapMove+5), *(interDepMapMove+6), *(interDepMapMove+7));
764768
if (interDepMask[l_i - _stFrame][l_j][l_k] == 1) {
769+
// fprintf(tf1, "%d:%d:%d:\n", l_i, l_j, l_k);
765770
for (l_m = 0; l_m < MAX_INTER_DEP_MB; ++l_m) {
766771
//LOGI(11, "%d,%d,%d,%d,%d,%d", l_i, l_j, l_k, l_m, *interDepMapMove, *(interDepMapMove+1));
767-
fprintf(tf, "%d,%d,%d,%d,%d,%d\n", l_i, l_j, l_k, l_m, *interDepMapMove, *(interDepMapMove+1));
768772
//mark the needed mb in the previous frame
769-
if ((*interDepMapMove < 0) || (*(interDepMapMove+1) < 0)) {
770-
//continue;
771-
} else if ((*interDepMapMove == 0) && (*(interDepMapMove+1) == 0)) {
772-
//continue;
773+
if (((*interDepMapMove) < 0) || (*(interDepMapMove+1) < 0)) {
774+
} else
775+
if (((*interDepMapMove) == 0) && (*(interDepMapMove+1) == 0)) {
773776
} else {
777+
//fprintf(tf, "%d,%d,%d,%d,%d,%d\n", l_i, l_j, l_k, l_m, *interDepMapMove, *(interDepMapMove+1));
778+
//fprintf(tf, "%d,%d,%d,%d,%d\n", l_i, l_j, l_k, *interDepMapMove, *(interDepMapMove+1));
774779
interDepMask[l_i - 1 - _stFrame][*interDepMapMove][*(interDepMapMove+1)] = 1;
775780
}
776781
interDepMapMove += 2;
@@ -781,7 +786,8 @@ static void compute_mb_mask_from_inter_frame_dependency(int p_videoFileIndex, in
781786
}
782787
}
783788
}
784-
fclose(tf);
789+
//fclose(tf);
790+
//fclose(tf1);
785791
LOGI(10, "end of compute_mb_mask_from_inter_frame_dependency");
786792
}
787793

@@ -901,7 +907,7 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
901907
fclose(tmpF);
902908
fclose(postF);
903909
//[REMOVE]for verification of file: verified the content written to binary file is correct
904-
load_inter_frame_mb_dependency(p_videoFileIndex);
910+
/*load_inter_frame_mb_dependency(p_videoFileIndex);
905911
interDepMapMove = interDepMap;
906912
sprintf(l_depInterFileName, "%s_inter_gop%d.txt.ver", gVideoFileNameList[p_videoFileIndex], gVideoPacketQueueList[p_videoFileIndex].dep_gop_num);
907913
tmpF = fopen(l_depInterFileName, "w");
@@ -911,18 +917,18 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
911917
for (k = 0; k < (gVideoCodecCtxList[p_videoFileIndex]->width + 15) / 16; ++k) {
912918
fprintf(tmpF, "%d:%d:%d:", i, j, k);
913919
for (m = 0; m < 4; ++m) {
914-
if ((*interDepMapMove == 0) && (*(interDepMapMove+1) == 0)) {
915-
} else {
920+
//if ((*interDepMapMove == 0) && (*(interDepMapMove+1) == 0)) {
921+
//} else {
916922
fprintf(tmpF, "%d:%d:", *interDepMapMove, *(interDepMapMove+1));
917-
}
923+
//}
918924
interDepMapMove += 2;
919925
}
920926
fprintf(tmpF, "\n");
921927
}
922928
}
923929
}
924930
fclose(tmpF);
925-
fclose(postF);
931+
fclose(postF);*/
926932
//post processing for intra-frame dependency
927933
sprintf(l_depIntraFileName, "%s_intra_gop%d.txt.tmp", gVideoFileNameList[p_videoFileIndex], gVideoPacketQueueList[p_videoFileIndex].dep_gop_num);
928934
sprintf(gVideoCodecCtxDepList[p_videoFileIndex]->g_intraDepFileName, "%s_intra_gop%d.txt", gVideoFileNameList[p_videoFileIndex], gVideoPacketQueueList[p_videoFileIndex].dep_gop_num);

0 commit comments

Comments
 (0)