优化读取fps

This commit is contained in:
猪小乐 2023-06-13 14:59:31 +00:00
parent 702cc168f3
commit 1583ffcb42

View File

@ -171,20 +171,6 @@
#include <vfw.h>
#endif
#ifndef LINUX
static int64_t gcd( int64_t a, int64_t b )
{
while (1)
{
int64_t c = a % b;
if( !c )
return b;
a = b;
b = c;
}
}
#endif
typedef struct {
#if !defined(LINUX)
PAVISTREAM p_avi;
@ -209,7 +195,6 @@ int open_file_avis( char *psz_filename, avis_input_t **p_handle, stream_info_t *
avis_input_t *h = malloc(sizeof(avis_input_t));
#if !defined(LINUX)
AVISTREAMINFO info;
int i;
*p_handle = h;
@ -244,11 +229,10 @@ int open_file_avis( char *psz_filename, avis_input_t **p_handle, stream_info_t *
p_param->i_width = info.rcFrame.right - info.rcFrame.left;
h->height =
p_param->i_height = info.rcFrame.bottom - info.rcFrame.top;
i = gcd(info.dwRate, info.dwScale);
p_param->i_fps_den = info.dwScale / i;
p_param->i_fps_num = info.dwRate / i;
p_param->i_fps_den = info.dwScale;
p_param->i_fps_num = info.dwRate;
fprintf( stderr, "avis [info]: %dx%d @ %.2f fps (%d frames)\n",
fprintf( stderr, "avis [info]: %dx%d @ %.3f fps (%d frames)\n",
p_param->i_width, p_param->i_height,
(double)p_param->i_fps_num / (double)p_param->i_fps_den,
(int)info.dwLength );