• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

Revisioncb50b199607fd52d604f84f3e1de75467a8b968e (tree)
Zeit2013-06-25 14:57:14
AutorAustin Yuan <shengquan.yuan@inte...>
CommiterXiang, Haihao

Log Message

h264encode: fix ftell overflow issue when open large source YUV files

Change-Id: I30190d4e28bd643f00808a15846e50e8fca28764
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>

Ändern Zusammenfassung

Diff

--- a/test/encode/h264encode.c
+++ b/test/encode/h264encode.c
@@ -702,7 +702,9 @@ static int print_help(void)
702702 {
703703 printf("./h264encode <options>\n");
704704 printf(" -w <width> -h <height>\n");
705+ printf(" -framecount <frame number>\n");
705706 printf(" -n <frame number>\n");
707+ printf(" if set to 0 and srcyuv is set, the frame count is from srcuv file\n");
706708 printf(" -o <coded file>\n");
707709 printf(" -f <frame rate>\n");
708710 printf(" --intra_period <number>\n");
@@ -738,8 +740,9 @@ static int process_cmdline(int argc, char *argv[])
738740 {"fourcc", required_argument, NULL, 11 },
739741 {"syncmode", no_argument, NULL, 12 },
740742 {"enablePSNR", no_argument, NULL, 13 },
741- {"privt", required_argument, NULL, 14 },
742- {"privv", required_argument, NULL, 15 },
743+ {"prit", required_argument, NULL, 14 },
744+ {"priv", required_argument, NULL, 15 },
745+ {"framecount", required_argument, NULL, 16 },
743746 {NULL, no_argument, NULL, 0 }};
744747 int long_index;
745748
@@ -752,6 +755,7 @@ static int process_cmdline(int argc, char *argv[])
752755 frame_height = atoi(optarg);
753756 break;
754757 case 'n':
758+ case 16:
755759 frame_count = atoi(optarg);
756760 break;
757761 case 'f':
@@ -843,9 +847,14 @@ static int process_cmdline(int argc, char *argv[])
843847 if (srcyuv_fp == NULL)
844848 printf("Open source YUV file %s failed, use auto-generated YUV data\n", srcyuv_fn);
845849 else {
846- fseek(srcyuv_fp, 0L, SEEK_END);
847- srcyuv_frames = ftell(srcyuv_fp) / (frame_width * frame_height * 1.5);
850+ struct stat tmp;
851+
852+ fstat(fileno(srcyuv_fp), &tmp);
853+ srcyuv_frames = tmp.st_size / (frame_width * frame_height * 1.5);
848854 printf("Source YUV file %s with %llu frames\n", srcyuv_fn, srcyuv_frames);
855+
856+ if (frame_count == 0)
857+ frame_count = srcyuv_frames;
849858 }
850859 }
851860