#include "cabac.h"
#include "cabac_functions.h"
#include "error_resilience.h"
+#include "golomb_legacy.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h264chroma.h"
#include "h264_mvpred.h"
#include "h264_ps.h"
-#include "golomb.h"
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"
h->enable_er = h1->enable_er;
h->workaround_bugs = h1->workaround_bugs;
+ h->x264_build = h1->x264_build;
h->droppable = h1->droppable;
// extradata/NAL handling
h->mb_aff_frame = h->ps.sps->mb_aff && (h->picture_structure == PICT_FRAME);
+ if (h->sei.unregistered.x264_build >= 0)
+ h->x264_build = h->sei.unregistered.x264_build;
+
assert(h->cur_pic_ptr->long_ref == 0);
return 0;
static enum AVPixelFormat get_pixel_format(H264Context *h)
{
#define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
- CONFIG_H264_D3D11VA_HWACCEL + \
+ (CONFIG_H264_D3D11VA_HWACCEL * 2) + \
CONFIG_H264_VAAPI_HWACCEL + \
(CONFIG_H264_VDA_HWACCEL * 2) + \
- CONFIG_H264_VDPAU_HWACCEL)
+ CONFIG_H264_VDPAU_HWACCEL + \
+ CONFIG_H264_CUVID_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
const enum AVPixelFormat *choices = pix_fmts;
case 8:
#if CONFIG_H264_VDPAU_HWACCEL
*fmt++ = AV_PIX_FMT_VDPAU;
+#endif
+#if CONFIG_H264_CUVID_HWACCEL
+ *fmt++ = AV_PIX_FMT_CUDA;
#endif
if (CHROMA444(h)) {
if (h->avctx->colorspace == AVCOL_SPC_RGB)
#endif
#if CONFIG_H264_D3D11VA_HWACCEL
*fmt++ = AV_PIX_FMT_D3D11VA_VLD;
+ *fmt++ = AV_PIX_FMT_D3D11;
#endif
#if CONFIG_H264_VAAPI_HWACCEL
*fmt++ = AV_PIX_FMT_VAAPI;
if (sps->timing_info_present_flag) {
int64_t den = sps->time_scale;
- if (h->sei.unregistered.x264_build < 44U)
+ if (h->x264_build < 44U)
den *= 2;
av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
sps->num_units_in_tick, den, 1 << 30);
/* Prioritize picture timing SEI information over used
* decoding process if it exists. */
- if (sps->pic_struct_present_flag) {
+ if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
H264SEIPictureTiming *pt = &h->sei.picture_timing;
switch (pt->pic_struct) {
- case SEI_PIC_STRUCT_FRAME:
+ case H264_SEI_PIC_STRUCT_FRAME:
break;
- case SEI_PIC_STRUCT_TOP_FIELD:
- case SEI_PIC_STRUCT_BOTTOM_FIELD:
+ case H264_SEI_PIC_STRUCT_TOP_FIELD:
+ case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
cur->f->interlaced_frame = 1;
break;
- case SEI_PIC_STRUCT_TOP_BOTTOM:
- case SEI_PIC_STRUCT_BOTTOM_TOP:
+ case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
+ case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
if (FIELD_OR_MBAFF_PICTURE(h))
cur->f->interlaced_frame = 1;
else
// try to flag soft telecine progressive
cur->f->interlaced_frame = h->prev_interlaced_frame;
break;
- case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
- case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
+ case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
+ case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
/* Signal the possibility of telecined film externally
* (pic_struct 5,6). From these hints, let the applications
* decide if they apply deinterlacing. */
cur->f->repeat_pict = 1;
break;
- case SEI_PIC_STRUCT_FRAME_DOUBLING:
+ case H264_SEI_PIC_STRUCT_FRAME_DOUBLING:
cur->f->repeat_pict = 2;
break;
- case SEI_PIC_STRUCT_FRAME_TRIPLING:
+ case H264_SEI_PIC_STRUCT_FRAME_TRIPLING:
cur->f->repeat_pict = 4;
break;
}
if ((pt->ct_type & 3) &&
- pt->pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
+ pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP)
cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0;
} else {
/* Derive interlacing flag from used decoding process. */
/* Derive top_field_first from field pocs. */
cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
} else {
- if (cur->f->interlaced_frame || sps->pic_struct_present_flag) {
+ if (cur->f->interlaced_frame ||
+ (sps->pic_struct_present_flag && h->sei.picture_timing.present)) {
/* Use picture timing SEI information. Even if it is a
* information of a past frame, better than nothing. */
- if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||
- h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
+ if (h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
+ h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->f->top_field_first = 1;
else
cur->f->top_field_first = 0;
a53->a53_caption_size = 0;
}
+ if (h->sei.alternative_transfer.present &&
+ av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) &&
+ h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
+ h->avctx->color_trc = cur->f->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
+ }
+
return 0;
}