/* encx264.c
Copyright (c) 2003-2017 HandBrake Team
This file is part of the HandBrake source code
Homepage: .
It may be used under the terms of the GNU General Public License v2.
For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
#include
#include "hb.h"
#include "hb_dict.h"
int h264_nvencInit( hb_work_object_t *, hb_job_t * );
int h264_nvencWork( hb_work_object_t *, hb_buffer_t **, hb_buffer_t ** );
void h264_nvencClose( hb_work_object_t * );
hb_work_object_t hb_h264_nvenc =
{
WORK_H264_NVENC,
"H.264/AVC encoder (h264_nvenc)",
h264_nvencInit,
h264_nvencWork,
h264_nvencClose
};
#define DTS_BUFFER_SIZE 32
/*
* The frame info struct remembers information about each frame across calls
* to x264_encoder_encode. Since frames are uniquely identified by their
* timestamp, we use some bits of the timestamp as an index. The LSB is
* chosen so that two successive frames will have different values in the
* bits over any plausible range of frame rates. (Starting with bit 8 allows
* any frame rate slower than 352fps.) The MSB determines the size of the array.
* It is chosen so that two frames can't use the same slot during the
* encoder's max frame delay (set by the standard as 16 frames) and so
* that, up to some minimum frame rate, frames are guaranteed to map to
* different slots. (An MSB of 17 which is 2^(17-8+1) = 1024 slots guarantees
* no collisions down to a rate of .7 fps).
*/
#define FRAME_INFO_MAX2 (8) // 2^8 = 256; 90000/256 = 352 frames/sec
#define FRAME_INFO_MIN2 (17) // 2^17 = 128K; 90000/131072 = 1.4 frames/sec
#define FRAME_INFO_SIZE (1 << (FRAME_INFO_MIN2 - FRAME_INFO_MAX2 + 1))
#define FRAME_INFO_MASK (FRAME_INFO_SIZE - 1)