X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fh264dec.c;h=4bfd78962d9ece474034b6749954464cb905ed99;hb=f6171471e6cfbd472f7ab71c12aa87510a07d4fd;hp=834c60c38c7e349fbc8d2a07d09f941eb2096f91;hpb=c3e84820d67cb1d8cfb4196f9b43971308a81571;p=ffmpeg diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 834c60c38c7..4bfd78962d9 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -36,6 +36,7 @@ #include "cabac_functions.h" #include "error_resilience.h" #include "avcodec.h" +#include "golomb_legacy.h" #include "h264.h" #include "h264dec.h" #include "h2645_parse.h" @@ -43,7 +44,7 @@ #include "h264chroma.h" #include "h264_mvpred.h" #include "h264_ps.h" -#include "golomb.h" +#include "hwaccel.h" #include "mathops.h" #include "me_cmp.h" #include "mpegutils.h" @@ -293,6 +294,7 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h->flags = avctx->flags; h->poc.prev_poc_msb = 1 << 16; h->recovery_frame = -1; + h->x264_build = -1; h->frame_recovered = 0; h->next_outputed_poc = INT_MIN; @@ -452,7 +454,6 @@ void ff_h264_flush_change(H264Context *h) if (h->cur_pic_ptr) h->cur_pic_ptr->reference = 0; h->first_field = 0; - ff_h264_sei_uninit(&h->sei); h->recovery_frame = -1; h->frame_recovered = 0; } @@ -466,6 +467,7 @@ static void flush_dpb(AVCodecContext *avctx) memset(h->delayed_pic, 0, sizeof(h->delayed_pic)); ff_h264_flush_change(h); + ff_h264_sei_uninit(&h->sei); for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) ff_h264_unref_picture(h, &h->DPB[i]); @@ -523,6 +525,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) { h->current_slice = 0; + h->field_started = 0; if (!h->first_field) h->cur_pic_ptr = NULL; ff_h264_sei_uninit(&h->sei); @@ -784,6 +787,33 @@ AVCodec ff_h264_decoder = { .capabilities = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS, + .hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_H264_CUVID_HWACCEL + HWACCEL_CUVID(h264), +#endif +#if CONFIG_H264_DXVA2_HWACCEL + HWACCEL_DXVA2(h264), +#endif +#if CONFIG_H264_D3D11VA_HWACCEL + HWACCEL_D3D11VA(h264), +#endif +#if CONFIG_H264_D3D11VA2_HWACCEL + HWACCEL_D3D11VA2(h264), +#endif +#if CONFIG_H264_VAAPI_HWACCEL + HWACCEL_VAAPI(h264), +#endif +#if CONFIG_H264_VDPAU_HWACCEL + HWACCEL_VDPAU(h264), +#endif +#if CONFIG_H264_VDA_HWACCEL + HW_CONFIG_HWACCEL(0, 0, 1, VDA, NONE, ff_h264_vda_hwaccel), +#endif +#if CONFIG_H264_VDA_OLD_HWACCEL + HW_CONFIG_HWACCEL(0, 0, 1, VDA_VLD, NONE, ff_h264_vda_old_hwaccel), +#endif + NULL + }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING, .flush = flush_dpb, .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),