diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-01 15:25:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 15:25:04 +0200 |
commit | 45c24f05d023a2cd8289ed40a13708392ce2e6a4 (patch) | |
tree | fef75d382fc6216a093eeaf80560473dff19d883 /media/ffvpx/libavcodec | |
parent | 79b00fc33b5cb6d56d29b50efac6d62ce3a89018 (diff) | |
download | UXP-45c24f05d023a2cd8289ed40a13708392ce2e6a4.tar UXP-45c24f05d023a2cd8289ed40a13708392ce2e6a4.tar.gz UXP-45c24f05d023a2cd8289ed40a13708392ce2e6a4.tar.lz UXP-45c24f05d023a2cd8289ed40a13708392ce2e6a4.tar.xz UXP-45c24f05d023a2cd8289ed40a13708392ce2e6a4.zip |
Revert "Update ffvpx code to 4.0.2"
Diffstat (limited to 'media/ffvpx/libavcodec')
55 files changed, 4083 insertions, 3237 deletions
diff --git a/media/ffvpx/libavcodec/allcodecs.c b/media/ffvpx/libavcodec/allcodecs.c index 4d4ef530e..4f34312e6 100644 --- a/media/ffvpx/libavcodec/allcodecs.c +++ b/media/ffvpx/libavcodec/allcodecs.c @@ -29,865 +29,732 @@ #include "avcodec.h" #include "version.h" -extern AVCodec ff_a64multi_encoder; -extern AVCodec ff_a64multi5_encoder; -extern AVCodec ff_aasc_decoder; -extern AVCodec ff_aic_decoder; -extern AVCodec ff_alias_pix_encoder; -extern AVCodec ff_alias_pix_decoder; -extern AVCodec ff_amv_encoder; -extern AVCodec ff_amv_decoder; -extern AVCodec ff_anm_decoder; -extern AVCodec ff_ansi_decoder; -extern AVCodec ff_apng_encoder; -extern AVCodec ff_apng_decoder; -extern AVCodec ff_asv1_encoder; -extern AVCodec ff_asv1_decoder; -extern AVCodec ff_asv2_encoder; -extern AVCodec ff_asv2_decoder; -extern AVCodec ff_aura_decoder; -extern AVCodec ff_aura2_decoder; -extern AVCodec ff_avrp_encoder; -extern AVCodec ff_avrp_decoder; -extern AVCodec ff_avrn_decoder; -extern AVCodec ff_avs_decoder; -extern AVCodec ff_avui_encoder; -extern AVCodec ff_avui_decoder; -extern AVCodec ff_ayuv_encoder; -extern AVCodec ff_ayuv_decoder; -extern AVCodec ff_bethsoftvid_decoder; -extern AVCodec ff_bfi_decoder; -extern AVCodec ff_bink_decoder; -extern AVCodec ff_bmp_encoder; -extern AVCodec ff_bmp_decoder; -extern AVCodec ff_bmv_video_decoder; -extern AVCodec ff_brender_pix_decoder; -extern AVCodec ff_c93_decoder; -extern AVCodec ff_cavs_decoder; -extern AVCodec ff_cdgraphics_decoder; -extern AVCodec ff_cdxl_decoder; -extern AVCodec ff_cfhd_decoder; -extern AVCodec ff_cinepak_encoder; -extern AVCodec ff_cinepak_decoder; -extern AVCodec ff_clearvideo_decoder; -extern AVCodec ff_cljr_encoder; -extern AVCodec ff_cljr_decoder; -extern AVCodec ff_cllc_decoder; -extern AVCodec ff_comfortnoise_encoder; -extern AVCodec ff_comfortnoise_decoder; -extern AVCodec ff_cpia_decoder; -extern AVCodec ff_cscd_decoder; -extern AVCodec ff_cyuv_decoder; -extern AVCodec ff_dds_decoder; -extern AVCodec ff_dfa_decoder; -extern AVCodec ff_dirac_decoder; -extern AVCodec ff_dnxhd_encoder; -extern AVCodec ff_dnxhd_decoder; -extern AVCodec ff_dpx_encoder; -extern AVCodec ff_dpx_decoder; -extern AVCodec ff_dsicinvideo_decoder; -extern AVCodec ff_dvaudio_decoder; -extern AVCodec ff_dvvideo_encoder; -extern AVCodec ff_dvvideo_decoder; -extern AVCodec ff_dxa_decoder; -extern AVCodec ff_dxtory_decoder; -extern AVCodec ff_dxv_decoder; -extern AVCodec ff_eacmv_decoder; -extern AVCodec ff_eamad_decoder; -extern AVCodec ff_eatgq_decoder; -extern AVCodec ff_eatgv_decoder; -extern AVCodec ff_eatqi_decoder; -extern AVCodec ff_eightbps_decoder; -extern AVCodec ff_eightsvx_exp_decoder; -extern AVCodec ff_eightsvx_fib_decoder; -extern AVCodec ff_escape124_decoder; -extern AVCodec ff_escape130_decoder; -extern AVCodec ff_exr_decoder; -extern AVCodec ff_ffv1_encoder; -extern AVCodec ff_ffv1_decoder; -extern AVCodec ff_ffvhuff_encoder; -extern AVCodec ff_ffvhuff_decoder; -extern AVCodec ff_fic_decoder; -extern AVCodec ff_fits_encoder; -extern AVCodec ff_fits_decoder; -extern AVCodec ff_flashsv_encoder; -extern AVCodec ff_flashsv_decoder; -extern AVCodec ff_flashsv2_encoder; -extern AVCodec ff_flashsv2_decoder; -extern AVCodec ff_flic_decoder; -extern AVCodec ff_flv_encoder; -extern AVCodec ff_flv_decoder; -extern AVCodec ff_fmvc_decoder; -extern AVCodec ff_fourxm_decoder; -extern AVCodec ff_fraps_decoder; -extern AVCodec ff_frwu_decoder; -extern AVCodec ff_g2m_decoder; -extern AVCodec ff_gdv_decoder; -extern AVCodec ff_gif_encoder; -extern AVCodec ff_gif_decoder; -extern AVCodec ff_h261_encoder; -extern AVCodec ff_h261_decoder; -extern AVCodec ff_h263_encoder; -extern AVCodec ff_h263_decoder; -extern AVCodec ff_h263i_decoder; -extern AVCodec ff_h263p_encoder; -extern AVCodec ff_h263p_decoder; -extern AVCodec ff_h263_v4l2m2m_decoder; -extern AVCodec ff_h264_decoder; -extern AVCodec ff_h264_crystalhd_decoder; -extern AVCodec ff_h264_v4l2m2m_decoder; -extern AVCodec ff_h264_mediacodec_decoder; -extern AVCodec ff_h264_mmal_decoder; -extern AVCodec ff_h264_qsv_decoder; -extern AVCodec ff_h264_rkmpp_decoder; -extern AVCodec ff_hap_encoder; -extern AVCodec ff_hap_decoder; -extern AVCodec ff_hevc_decoder; -extern AVCodec ff_hevc_qsv_decoder; -extern AVCodec ff_hevc_rkmpp_decoder; -extern AVCodec ff_hevc_v4l2m2m_decoder; -extern AVCodec ff_hnm4_video_decoder; -extern AVCodec ff_hq_hqa_decoder; -extern AVCodec ff_hqx_decoder; -extern AVCodec ff_huffyuv_encoder; -extern AVCodec ff_huffyuv_decoder; -extern AVCodec ff_idcin_decoder; -extern AVCodec ff_iff_ilbm_decoder; -extern AVCodec ff_indeo2_decoder; -extern AVCodec ff_indeo3_decoder; -extern AVCodec ff_indeo4_decoder; -extern AVCodec ff_indeo5_decoder; -extern AVCodec ff_interplay_video_decoder; -extern AVCodec ff_jpeg2000_encoder; -extern AVCodec ff_jpeg2000_decoder; -extern AVCodec ff_jpegls_encoder; -extern AVCodec ff_jpegls_decoder; -extern AVCodec ff_jv_decoder; -extern AVCodec ff_kgv1_decoder; -extern AVCodec ff_kmvc_decoder; -extern AVCodec ff_lagarith_decoder; -extern AVCodec ff_ljpeg_encoder; -extern AVCodec ff_loco_decoder; -extern AVCodec ff_m101_decoder; -extern AVCodec ff_magicyuv_encoder; -extern AVCodec ff_magicyuv_decoder; -extern AVCodec ff_mdec_decoder; -extern AVCodec ff_mimic_decoder; -extern AVCodec ff_mjpeg_encoder; -extern AVCodec ff_mjpeg_decoder; -extern AVCodec ff_mjpegb_decoder; -extern AVCodec ff_mmvideo_decoder; -extern AVCodec ff_motionpixels_decoder; -extern AVCodec ff_mpeg1video_encoder; -extern AVCodec ff_mpeg1video_decoder; -extern AVCodec ff_mpeg2video_encoder; -extern AVCodec ff_mpeg2video_decoder; -extern AVCodec ff_mpeg4_encoder; -extern AVCodec ff_mpeg4_decoder; -extern AVCodec ff_mpeg4_crystalhd_decoder; -extern AVCodec ff_mpeg4_v4l2m2m_decoder; -extern AVCodec ff_mpeg4_mmal_decoder; -extern AVCodec ff_mpegvideo_decoder; -extern AVCodec ff_mpeg1_v4l2m2m_decoder; -extern AVCodec ff_mpeg2_mmal_decoder; -extern AVCodec ff_mpeg2_crystalhd_decoder; -extern AVCodec ff_mpeg2_v4l2m2m_decoder; -extern AVCodec ff_mpeg2_qsv_decoder; -extern AVCodec ff_mpeg2_mediacodec_decoder; -extern AVCodec ff_msa1_decoder; -extern AVCodec ff_mscc_decoder; -extern AVCodec ff_msmpeg4v1_decoder; -extern AVCodec ff_msmpeg4v2_encoder; -extern AVCodec ff_msmpeg4v2_decoder; -extern AVCodec ff_msmpeg4v3_encoder; -extern AVCodec ff_msmpeg4v3_decoder; -extern AVCodec ff_msmpeg4_crystalhd_decoder; -extern AVCodec ff_msrle_decoder; -extern AVCodec ff_mss1_decoder; -extern AVCodec ff_mss2_decoder; -extern AVCodec ff_msvideo1_encoder; -extern AVCodec ff_msvideo1_decoder; -extern AVCodec ff_mszh_decoder; -extern AVCodec ff_mts2_decoder; -extern AVCodec ff_mvc1_decoder; -extern AVCodec ff_mvc2_decoder; -extern AVCodec ff_mxpeg_decoder; -extern AVCodec ff_nuv_decoder; -extern AVCodec ff_paf_video_decoder; -extern AVCodec ff_pam_encoder; -extern AVCodec ff_pam_decoder; -extern AVCodec ff_pbm_encoder; -extern AVCodec ff_pbm_decoder; -extern AVCodec ff_pcx_encoder; -extern AVCodec ff_pcx_decoder; -extern AVCodec ff_pgm_encoder; -extern AVCodec ff_pgm_decoder; -extern AVCodec ff_pgmyuv_encoder; -extern AVCodec ff_pgmyuv_decoder; -extern AVCodec ff_pictor_decoder; -extern AVCodec ff_pixlet_decoder; -extern AVCodec ff_png_encoder; -extern AVCodec ff_png_decoder; -extern AVCodec ff_ppm_encoder; -extern AVCodec ff_ppm_decoder; -extern AVCodec ff_prores_encoder; -extern AVCodec ff_prores_decoder; -extern AVCodec ff_prores_aw_encoder; -extern AVCodec ff_prores_ks_encoder; -extern AVCodec ff_prores_lgpl_decoder; -extern AVCodec ff_psd_decoder; -extern AVCodec ff_ptx_decoder; -extern AVCodec ff_qdraw_decoder; -extern AVCodec ff_qpeg_decoder; -extern AVCodec ff_qtrle_encoder; -extern AVCodec ff_qtrle_decoder; -extern AVCodec ff_r10k_encoder; -extern AVCodec ff_r10k_decoder; -extern AVCodec ff_r210_encoder; -extern AVCodec ff_r210_decoder; -extern AVCodec ff_rawvideo_encoder; -extern AVCodec ff_rawvideo_decoder; -extern AVCodec ff_rl2_decoder; -extern AVCodec ff_roq_encoder; -extern AVCodec ff_roq_decoder; -extern AVCodec ff_rpza_decoder; -extern AVCodec ff_rscc_decoder; -extern AVCodec ff_rv10_encoder; -extern AVCodec ff_rv10_decoder; -extern AVCodec ff_rv20_encoder; -extern AVCodec ff_rv20_decoder; -extern AVCodec ff_rv30_decoder; -extern AVCodec ff_rv40_decoder; -extern AVCodec ff_s302m_encoder; -extern AVCodec ff_s302m_decoder; -extern AVCodec ff_sanm_decoder; -extern AVCodec ff_scpr_decoder; -extern AVCodec ff_screenpresso_decoder; -extern AVCodec ff_sdx2_dpcm_decoder; -extern AVCodec ff_sgi_encoder; -extern AVCodec ff_sgi_decoder; -extern AVCodec ff_sgirle_decoder; -extern AVCodec ff_sheervideo_decoder; -extern AVCodec ff_smacker_decoder; -extern AVCodec ff_smc_decoder; -extern AVCodec ff_smvjpeg_decoder; -extern AVCodec ff_snow_encoder; -extern AVCodec ff_snow_decoder; -extern AVCodec ff_sp5x_decoder; -extern AVCodec ff_speedhq_decoder; -extern AVCodec ff_srgc_decoder; -extern AVCodec ff_sunrast_encoder; -extern AVCodec ff_sunrast_decoder; -extern AVCodec ff_svq1_encoder; -extern AVCodec ff_svq1_decoder; -extern AVCodec ff_svq3_decoder; -extern AVCodec ff_targa_encoder; -extern AVCodec ff_targa_decoder; -extern AVCodec ff_targa_y216_decoder; -extern AVCodec ff_tdsc_decoder; -extern AVCodec ff_theora_decoder; -extern AVCodec ff_thp_decoder; -extern AVCodec ff_tiertexseqvideo_decoder; -extern AVCodec ff_tiff_encoder; -extern AVCodec ff_tiff_decoder; -extern AVCodec ff_tmv_decoder; -extern AVCodec ff_truemotion1_decoder; -extern AVCodec ff_truemotion2_decoder; -extern AVCodec ff_truemotion2rt_decoder; -extern AVCodec ff_tscc_decoder; -extern AVCodec ff_tscc2_decoder; -extern AVCodec ff_txd_decoder; -extern AVCodec ff_ulti_decoder; -extern AVCodec ff_utvideo_encoder; -extern AVCodec ff_utvideo_decoder; -extern AVCodec ff_v210_encoder; -extern AVCodec ff_v210_decoder; -extern AVCodec ff_v210x_decoder; -extern AVCodec ff_v308_encoder; -extern AVCodec ff_v308_decoder; -extern AVCodec ff_v408_encoder; -extern AVCodec ff_v408_decoder; -extern AVCodec ff_v410_encoder; -extern AVCodec ff_v410_decoder; -extern AVCodec ff_vb_decoder; -extern AVCodec ff_vble_decoder; -extern AVCodec ff_vc1_decoder; -extern AVCodec ff_vc1_crystalhd_decoder; -extern AVCodec ff_vc1image_decoder; -extern AVCodec ff_vc1_mmal_decoder; -extern AVCodec ff_vc1_qsv_decoder; -extern AVCodec ff_vc1_v4l2m2m_decoder; -extern AVCodec ff_vc2_encoder; -extern AVCodec ff_vcr1_decoder; -extern AVCodec ff_vmdvideo_decoder; -extern AVCodec ff_vmnc_decoder; -extern AVCodec ff_vp3_decoder; -extern AVCodec ff_vp5_decoder; -extern AVCodec ff_vp6_decoder; -extern AVCodec ff_vp6a_decoder; -extern AVCodec ff_vp6f_decoder; -extern AVCodec ff_vp7_decoder; -extern AVCodec ff_vp8_decoder; -extern AVCodec ff_vp8_rkmpp_decoder; -extern AVCodec ff_vp8_v4l2m2m_decoder; -extern AVCodec ff_vp9_decoder; -extern AVCodec ff_vp9_rkmpp_decoder; -extern AVCodec ff_vp9_v4l2m2m_decoder; -extern AVCodec ff_vqa_decoder; -extern AVCodec ff_bitpacked_decoder; -extern AVCodec ff_webp_decoder; -extern AVCodec ff_wrapped_avframe_encoder; -extern AVCodec ff_wrapped_avframe_decoder; -extern AVCodec ff_wmv1_encoder; -extern AVCodec ff_wmv1_decoder; -extern AVCodec ff_wmv2_encoder; -extern AVCodec ff_wmv2_decoder; -extern AVCodec ff_wmv3_decoder; -extern AVCodec ff_wmv3_crystalhd_decoder; -extern AVCodec ff_wmv3image_decoder; -extern AVCodec ff_wnv1_decoder; -extern AVCodec ff_xan_wc3_decoder; -extern AVCodec ff_xan_wc4_decoder; -extern AVCodec ff_xbm_encoder; -extern AVCodec ff_xbm_decoder; -extern AVCodec ff_xface_encoder; -extern AVCodec ff_xface_decoder; -extern AVCodec ff_xl_decoder; -extern AVCodec ff_xpm_decoder; -extern AVCodec ff_xwd_encoder; -extern AVCodec ff_xwd_decoder; -extern AVCodec ff_y41p_encoder; -extern AVCodec ff_y41p_decoder; -extern AVCodec ff_ylc_decoder; -extern AVCodec ff_yop_decoder; -extern AVCodec ff_yuv4_encoder; -extern AVCodec ff_yuv4_decoder; -extern AVCodec ff_zero12v_decoder; -extern AVCodec ff_zerocodec_decoder; -extern AVCodec ff_zlib_encoder; -extern AVCodec ff_zlib_decoder; -extern AVCodec ff_zmbv_encoder; -extern AVCodec ff_zmbv_decoder; - -/* audio codecs */ -extern AVCodec ff_aac_encoder; -extern AVCodec ff_aac_decoder; -extern AVCodec ff_aac_fixed_decoder; -extern AVCodec ff_aac_latm_decoder; -extern AVCodec ff_ac3_encoder; -extern AVCodec ff_ac3_decoder; -extern AVCodec ff_ac3_fixed_encoder; -extern AVCodec ff_ac3_fixed_decoder; -extern AVCodec ff_alac_encoder; -extern AVCodec ff_alac_decoder; -extern AVCodec ff_als_decoder; -extern AVCodec ff_amrnb_decoder; -extern AVCodec ff_amrwb_decoder; -extern AVCodec ff_ape_decoder; -extern AVCodec ff_aptx_encoder; -extern AVCodec ff_aptx_decoder; -extern AVCodec ff_aptx_hd_encoder; -extern AVCodec ff_aptx_hd_decoder; -extern AVCodec ff_atrac1_decoder; -extern AVCodec ff_atrac3_decoder; -extern AVCodec ff_atrac3al_decoder; -extern AVCodec ff_atrac3p_decoder; -extern AVCodec ff_atrac3pal_decoder; -extern AVCodec ff_binkaudio_dct_decoder; -extern AVCodec ff_binkaudio_rdft_decoder; -extern AVCodec ff_bmv_audio_decoder; -extern AVCodec ff_cook_decoder; -extern AVCodec ff_dca_encoder; -extern AVCodec ff_dca_decoder; -extern AVCodec ff_dolby_e_decoder; -extern AVCodec ff_dsd_lsbf_decoder; -extern AVCodec ff_dsd_msbf_decoder; -extern AVCodec ff_dsd_lsbf_planar_decoder; -extern AVCodec ff_dsd_msbf_planar_decoder; -extern AVCodec ff_dsicinaudio_decoder; -extern AVCodec ff_dss_sp_decoder; -extern AVCodec ff_dst_decoder; -extern AVCodec ff_eac3_encoder; -extern AVCodec ff_eac3_decoder; -extern AVCodec ff_evrc_decoder; -extern AVCodec ff_ffwavesynth_decoder; -extern AVCodec ff_flac_encoder; -extern AVCodec ff_flac_decoder; -extern AVCodec ff_g723_1_encoder; -extern AVCodec ff_g723_1_decoder; -extern AVCodec ff_g729_decoder; -extern AVCodec ff_gsm_decoder; -extern AVCodec ff_gsm_ms_decoder; -extern AVCodec ff_iac_decoder; -extern AVCodec ff_imc_decoder; -extern AVCodec ff_interplay_acm_decoder; -extern AVCodec ff_mace3_decoder; -extern AVCodec ff_mace6_decoder; -extern AVCodec ff_metasound_decoder; -extern AVCodec ff_mlp_encoder; -extern AVCodec ff_mlp_decoder; -extern AVCodec ff_mp1_decoder; -extern AVCodec ff_mp1float_decoder; -extern AVCodec ff_mp2_encoder; -extern AVCodec ff_mp2_decoder; -extern AVCodec ff_mp2float_decoder; -extern AVCodec ff_mp2fixed_encoder; -extern AVCodec ff_mp3float_decoder; -extern AVCodec ff_mp3_decoder; -extern AVCodec ff_mp3adufloat_decoder; -extern AVCodec ff_mp3adu_decoder; -extern AVCodec ff_mp3on4float_decoder; -extern AVCodec ff_mp3on4_decoder; -extern AVCodec ff_mpc7_decoder; -extern AVCodec ff_mpc8_decoder; -extern AVCodec ff_nellymoser_encoder; -extern AVCodec ff_nellymoser_decoder; -extern AVCodec ff_on2avc_decoder; -extern AVCodec ff_opus_encoder; -extern AVCodec ff_opus_decoder; -extern AVCodec ff_paf_audio_decoder; -extern AVCodec ff_qcelp_decoder; -extern AVCodec ff_qdm2_decoder; -extern AVCodec ff_qdmc_decoder; -extern AVCodec ff_ra_144_encoder; -extern AVCodec ff_ra_144_decoder; -extern AVCodec ff_ra_288_decoder; -extern AVCodec ff_ralf_decoder; -extern AVCodec ff_sbc_encoder; -extern AVCodec ff_sbc_decoder; -extern AVCodec ff_shorten_decoder; -extern AVCodec ff_sipr_decoder; -extern AVCodec ff_smackaud_decoder; -extern AVCodec ff_sonic_encoder; -extern AVCodec ff_sonic_decoder; -extern AVCodec ff_sonic_ls_encoder; -extern AVCodec ff_tak_decoder; -extern AVCodec ff_truehd_encoder; -extern AVCodec ff_truehd_decoder; -extern AVCodec ff_truespeech_decoder; -extern AVCodec ff_tta_encoder; -extern AVCodec ff_tta_decoder; -extern AVCodec ff_twinvq_decoder; -extern AVCodec ff_vmdaudio_decoder; -extern AVCodec ff_vorbis_encoder; -extern AVCodec ff_vorbis_decoder; -extern AVCodec ff_wavpack_encoder; -extern AVCodec ff_wavpack_decoder; -extern AVCodec ff_wmalossless_decoder; -extern AVCodec ff_wmapro_decoder; -extern AVCodec ff_wmav1_encoder; -extern AVCodec ff_wmav1_decoder; -extern AVCodec ff_wmav2_encoder; -extern AVCodec ff_wmav2_decoder; -extern AVCodec ff_wmavoice_decoder; -extern AVCodec ff_ws_snd1_decoder; -extern AVCodec ff_xma1_decoder; -extern AVCodec ff_xma2_decoder; - -/* PCM codecs */ -extern AVCodec ff_pcm_alaw_encoder; -extern AVCodec ff_pcm_alaw_decoder; -extern AVCodec ff_pcm_bluray_decoder; -extern AVCodec ff_pcm_dvd_decoder; -extern AVCodec ff_pcm_f16le_decoder; -extern AVCodec ff_pcm_f24le_decoder; -extern AVCodec ff_pcm_f32be_encoder; -extern AVCodec ff_pcm_f32be_decoder; -extern AVCodec ff_pcm_f32le_encoder; -extern AVCodec ff_pcm_f32le_decoder; -extern AVCodec ff_pcm_f64be_encoder; -extern AVCodec ff_pcm_f64be_decoder; -extern AVCodec ff_pcm_f64le_encoder; -extern AVCodec ff_pcm_f64le_decoder; -extern AVCodec ff_pcm_lxf_decoder; -extern AVCodec ff_pcm_mulaw_encoder; -extern AVCodec ff_pcm_mulaw_decoder; -extern AVCodec ff_pcm_s8_encoder; -extern AVCodec ff_pcm_s8_decoder; -extern AVCodec ff_pcm_s8_planar_encoder; -extern AVCodec ff_pcm_s8_planar_decoder; -extern AVCodec ff_pcm_s16be_encoder; -extern AVCodec ff_pcm_s16be_decoder; -extern AVCodec ff_pcm_s16be_planar_encoder; -extern AVCodec ff_pcm_s16be_planar_decoder; -extern AVCodec ff_pcm_s16le_encoder; -extern AVCodec ff_pcm_s16le_decoder; -extern AVCodec ff_pcm_s16le_planar_encoder; -extern AVCodec ff_pcm_s16le_planar_decoder; -extern AVCodec ff_pcm_s24be_encoder; -extern AVCodec ff_pcm_s24be_decoder; -extern AVCodec ff_pcm_s24daud_encoder; -extern AVCodec ff_pcm_s24daud_decoder; -extern AVCodec ff_pcm_s24le_encoder; -extern AVCodec ff_pcm_s24le_decoder; -extern AVCodec ff_pcm_s24le_planar_encoder; -extern AVCodec ff_pcm_s24le_planar_decoder; -extern AVCodec ff_pcm_s32be_encoder; -extern AVCodec ff_pcm_s32be_decoder; -extern AVCodec ff_pcm_s32le_encoder; -extern AVCodec ff_pcm_s32le_decoder; -extern AVCodec ff_pcm_s32le_planar_encoder; -extern AVCodec ff_pcm_s32le_planar_decoder; -extern AVCodec ff_pcm_s64be_encoder; -extern AVCodec ff_pcm_s64be_decoder; -extern AVCodec ff_pcm_s64le_encoder; -extern AVCodec ff_pcm_s64le_decoder; -extern AVCodec ff_pcm_u8_encoder; -extern AVCodec ff_pcm_u8_decoder; -extern AVCodec ff_pcm_u16be_encoder; -extern AVCodec ff_pcm_u16be_decoder; -extern AVCodec ff_pcm_u16le_encoder; -extern AVCodec ff_pcm_u16le_decoder; -extern AVCodec ff_pcm_u24be_encoder; -extern AVCodec ff_pcm_u24be_decoder; -extern AVCodec ff_pcm_u24le_encoder; -extern AVCodec ff_pcm_u24le_decoder; -extern AVCodec ff_pcm_u32be_encoder; -extern AVCodec ff_pcm_u32be_decoder; -extern AVCodec ff_pcm_u32le_encoder; -extern AVCodec ff_pcm_u32le_decoder; -extern AVCodec ff_pcm_zork_decoder; - -/* DPCM codecs */ -extern AVCodec ff_gremlin_dpcm_decoder; -extern AVCodec ff_interplay_dpcm_decoder; -extern AVCodec ff_roq_dpcm_encoder; -extern AVCodec ff_roq_dpcm_decoder; -extern AVCodec ff_sol_dpcm_decoder; -extern AVCodec ff_xan_dpcm_decoder; - -/* ADPCM codecs */ -extern AVCodec ff_adpcm_4xm_decoder; -extern AVCodec ff_adpcm_adx_encoder; -extern AVCodec ff_adpcm_adx_decoder; -extern AVCodec ff_adpcm_afc_decoder; -extern AVCodec ff_adpcm_aica_decoder; -extern AVCodec ff_adpcm_ct_decoder; -extern AVCodec ff_adpcm_dtk_decoder; -extern AVCodec ff_adpcm_ea_decoder; -extern AVCodec ff_adpcm_ea_maxis_xa_decoder; -extern AVCodec ff_adpcm_ea_r1_decoder; -extern AVCodec ff_adpcm_ea_r2_decoder; -extern AVCodec ff_adpcm_ea_r3_decoder; -extern AVCodec ff_adpcm_ea_xas_decoder; -extern AVCodec ff_adpcm_g722_encoder; -extern AVCodec ff_adpcm_g722_decoder; -extern AVCodec ff_adpcm_g726_encoder; -extern AVCodec ff_adpcm_g726_decoder; -extern AVCodec ff_adpcm_g726le_encoder; -extern AVCodec ff_adpcm_g726le_decoder; -extern AVCodec ff_adpcm_ima_amv_decoder; -extern AVCodec ff_adpcm_ima_apc_decoder; -extern AVCodec ff_adpcm_ima_dat4_decoder; -extern AVCodec ff_adpcm_ima_dk3_decoder; -extern AVCodec ff_adpcm_ima_dk4_decoder; -extern AVCodec ff_adpcm_ima_ea_eacs_decoder; -extern AVCodec ff_adpcm_ima_ea_sead_decoder; -extern AVCodec ff_adpcm_ima_iss_decoder; -extern AVCodec ff_adpcm_ima_oki_decoder; -extern AVCodec ff_adpcm_ima_qt_encoder; -extern AVCodec ff_adpcm_ima_qt_decoder; -extern AVCodec ff_adpcm_ima_rad_decoder; -extern AVCodec ff_adpcm_ima_smjpeg_decoder; -extern AVCodec ff_adpcm_ima_wav_encoder; -extern AVCodec ff_adpcm_ima_wav_decoder; -extern AVCodec ff_adpcm_ima_ws_decoder; -extern AVCodec ff_adpcm_ms_encoder; -extern AVCodec ff_adpcm_ms_decoder; -extern AVCodec ff_adpcm_mtaf_decoder; -extern AVCodec ff_adpcm_psx_decoder; -extern AVCodec ff_adpcm_sbpro_2_decoder; -extern AVCodec ff_adpcm_sbpro_3_decoder; -extern AVCodec ff_adpcm_sbpro_4_decoder; -extern AVCodec ff_adpcm_swf_encoder; -extern AVCodec ff_adpcm_swf_decoder; -extern AVCodec ff_adpcm_thp_decoder; -extern AVCodec ff_adpcm_thp_le_decoder; -extern AVCodec ff_adpcm_vima_decoder; -extern AVCodec ff_adpcm_xa_decoder; -extern AVCodec ff_adpcm_yamaha_encoder; -extern AVCodec ff_adpcm_yamaha_decoder; - -/* subtitles */ -extern AVCodec ff_ssa_encoder; -extern AVCodec ff_ssa_decoder; -extern AVCodec ff_ass_encoder; -extern AVCodec ff_ass_decoder; -extern AVCodec ff_ccaption_decoder; -extern AVCodec ff_dvbsub_encoder; -extern AVCodec ff_dvbsub_decoder; -extern AVCodec ff_dvdsub_encoder; -extern AVCodec ff_dvdsub_decoder; -extern AVCodec ff_jacosub_decoder; -extern AVCodec ff_microdvd_decoder; -extern AVCodec ff_movtext_encoder; -extern AVCodec ff_movtext_decoder; -extern AVCodec ff_mpl2_decoder; -extern AVCodec ff_pgssub_decoder; -extern AVCodec ff_pjs_decoder; -extern AVCodec ff_realtext_decoder; -extern AVCodec ff_sami_decoder; -extern AVCodec ff_srt_encoder; -extern AVCodec ff_srt_decoder; -extern AVCodec ff_stl_decoder; -extern AVCodec ff_subrip_encoder; -extern AVCodec ff_subrip_decoder; -extern AVCodec ff_subviewer_decoder; -extern AVCodec ff_subviewer1_decoder; -extern AVCodec ff_text_encoder; -extern AVCodec ff_text_decoder; -extern AVCodec ff_vplayer_decoder; -extern AVCodec ff_webvtt_encoder; -extern AVCodec ff_webvtt_decoder; -extern AVCodec ff_xsub_encoder; -extern AVCodec ff_xsub_decoder; - -/* external libraries */ -extern AVCodec ff_aac_at_encoder; -extern AVCodec ff_aac_at_decoder; -extern AVCodec ff_ac3_at_decoder; -extern AVCodec ff_adpcm_ima_qt_at_decoder; -extern AVCodec ff_alac_at_encoder; -extern AVCodec ff_alac_at_decoder; -extern AVCodec ff_amr_nb_at_decoder; -extern AVCodec ff_eac3_at_decoder; -extern AVCodec ff_gsm_ms_at_decoder; -extern AVCodec ff_ilbc_at_encoder; -extern AVCodec ff_ilbc_at_decoder; -extern AVCodec ff_mp1_at_decoder; -extern AVCodec ff_mp2_at_decoder; -extern AVCodec ff_mp3_at_decoder; -extern AVCodec ff_pcm_alaw_at_encoder; -extern AVCodec ff_pcm_alaw_at_decoder; -extern AVCodec ff_pcm_mulaw_at_encoder; -extern AVCodec ff_pcm_mulaw_at_decoder; -extern AVCodec ff_qdmc_at_decoder; -extern AVCodec ff_qdm2_at_decoder; -extern AVCodec ff_libaom_av1_decoder; -extern AVCodec ff_libaom_av1_encoder; -extern AVCodec ff_libcelt_decoder; -extern AVCodec ff_libcodec2_encoder; -extern AVCodec ff_libcodec2_decoder; -extern AVCodec ff_libfdk_aac_encoder; -extern AVCodec ff_libfdk_aac_decoder; -extern AVCodec ff_libgsm_encoder; -extern AVCodec ff_libgsm_decoder; -extern AVCodec ff_libgsm_ms_encoder; -extern AVCodec ff_libgsm_ms_decoder; -extern AVCodec ff_libilbc_encoder; -extern AVCodec ff_libilbc_decoder; -extern AVCodec ff_libmp3lame_encoder; -extern AVCodec ff_libopencore_amrnb_encoder; -extern AVCodec ff_libopencore_amrnb_decoder; -extern AVCodec ff_libopencore_amrwb_decoder; -extern AVCodec ff_libopenjpeg_encoder; -extern AVCodec ff_libopenjpeg_decoder; -extern AVCodec ff_libopus_encoder; -extern AVCodec ff_libopus_decoder; -extern AVCodec ff_librsvg_decoder; -extern AVCodec ff_libshine_encoder; -extern AVCodec ff_libspeex_encoder; -extern AVCodec ff_libspeex_decoder; -extern AVCodec ff_libtheora_encoder; -extern AVCodec ff_libtwolame_encoder; -extern AVCodec ff_libvo_amrwbenc_encoder; -extern AVCodec ff_libvorbis_encoder; -extern AVCodec ff_libvorbis_decoder; -extern AVCodec ff_libvpx_vp8_encoder; -extern AVCodec ff_libvpx_vp8_decoder; -extern AVCodec ff_libvpx_vp9_encoder; -extern AVCodec ff_libvpx_vp9_decoder; -extern AVCodec ff_libwavpack_encoder; -/* preferred over libwebp */ -extern AVCodec ff_libwebp_anim_encoder; -extern AVCodec ff_libwebp_encoder; -extern AVCodec ff_libx262_encoder; -extern AVCodec ff_libx264_encoder; -extern AVCodec ff_libx264rgb_encoder; -extern AVCodec ff_libx265_encoder; -extern AVCodec ff_libxavs_encoder; -extern AVCodec ff_libxvid_encoder; -extern AVCodec ff_libzvbi_teletext_decoder; - -/* text */ -extern AVCodec ff_bintext_decoder; -extern AVCodec ff_xbin_decoder; -extern AVCodec ff_idf_decoder; - -/* external libraries, that shouldn't be used by default if one of the - * above is available */ -extern AVCodec ff_h263_v4l2m2m_encoder; -extern AVCodec ff_libopenh264_encoder; -extern AVCodec ff_libopenh264_decoder; -extern AVCodec ff_h264_amf_encoder; -extern AVCodec ff_h264_cuvid_decoder; -extern AVCodec ff_h264_nvenc_encoder; -extern AVCodec ff_h264_omx_encoder; -extern AVCodec ff_h264_qsv_encoder; -extern AVCodec ff_h264_v4l2m2m_encoder; -extern AVCodec ff_h264_vaapi_encoder; -extern AVCodec ff_h264_videotoolbox_encoder; -#if FF_API_NVENC_OLD_NAME -extern AVCodec ff_nvenc_encoder; -extern AVCodec ff_nvenc_h264_encoder; -extern AVCodec ff_nvenc_hevc_encoder; -#endif -extern AVCodec ff_hevc_amf_encoder; -extern AVCodec ff_hevc_cuvid_decoder; -extern AVCodec ff_hevc_mediacodec_decoder; -extern AVCodec ff_hevc_nvenc_encoder; -extern AVCodec ff_hevc_qsv_encoder; -extern AVCodec ff_hevc_v4l2m2m_encoder; -extern AVCodec ff_hevc_vaapi_encoder; -extern AVCodec ff_hevc_videotoolbox_encoder; -extern AVCodec ff_libkvazaar_encoder; -extern AVCodec ff_mjpeg_cuvid_decoder; -extern AVCodec ff_mjpeg_qsv_encoder; -extern AVCodec ff_mjpeg_vaapi_encoder; -extern AVCodec ff_mpeg1_cuvid_decoder; -extern AVCodec ff_mpeg2_cuvid_decoder; -extern AVCodec ff_mpeg2_qsv_encoder; -extern AVCodec ff_mpeg2_vaapi_encoder; -extern AVCodec ff_mpeg4_cuvid_decoder; -extern AVCodec ff_mpeg4_mediacodec_decoder; -extern AVCodec ff_mpeg4_v4l2m2m_encoder; -extern AVCodec ff_vc1_cuvid_decoder; -extern AVCodec ff_vp8_cuvid_decoder; -extern AVCodec ff_vp8_mediacodec_decoder; -extern AVCodec ff_vp8_qsv_decoder; -extern AVCodec ff_vp8_v4l2m2m_encoder; -extern AVCodec ff_vp8_vaapi_encoder; -extern AVCodec ff_vp9_cuvid_decoder; -extern AVCodec ff_vp9_mediacodec_decoder; -extern AVCodec ff_vp9_vaapi_encoder; - -#include "libavcodec/codec_list.c" - -static AVOnce av_codec_static_init = AV_ONCE_INIT; -static void av_codec_init_static(void) -{ - for (int i = 0; codec_list[i]; i++) { - if (codec_list[i]->init_static_data) - codec_list[i]->init_static_data((AVCodec*)codec_list[i]); +#define REGISTER_HWACCEL(X, x) \ + { \ + extern AVHWAccel ff_##x##_hwaccel; \ + if (CONFIG_##X##_HWACCEL) \ + av_register_hwaccel(&ff_##x##_hwaccel); \ } -} - -const AVCodec *av_codec_iterate(void **opaque) -{ - uintptr_t i = (uintptr_t)*opaque; - const AVCodec *c = codec_list[i]; - ff_thread_once(&av_codec_static_init, av_codec_init_static); - - if (c) - *opaque = (void*)(i + 1); - - return c; -} - -#if FF_API_NEXT -FF_DISABLE_DEPRECATION_WARNINGS -static AVOnce av_codec_next_init = AV_ONCE_INIT; - -static void av_codec_init_next(void) -{ - AVCodec *prev = NULL, *p; - void *i = 0; - while ((p = (AVCodec*)av_codec_iterate(&i))) { - if (prev) - prev->next = p; - prev = p; +#define REGISTER_ENCODER(X, x) \ + { \ + extern AVCodec ff_##x##_encoder; \ + if (CONFIG_##X##_ENCODER) \ + avcodec_register(&ff_##x##_encoder); \ } -} - - - -av_cold void avcodec_register(AVCodec *codec) -{ - ff_thread_once(&av_codec_next_init, av_codec_init_next); -} - -AVCodec *av_codec_next(const AVCodec *c) -{ - ff_thread_once(&av_codec_next_init, av_codec_init_next); - - if (c) - return c->next; - else - return (AVCodec*)codec_list[0]; -} -void avcodec_register_all(void) -{ - ff_thread_once(&av_codec_next_init, av_codec_init_next); -} -FF_ENABLE_DEPRECATION_WARNINGS -#endif - -static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) -{ - switch(id){ - //This is for future deprecatec codec ids, its empty since - //last major bump but will fill up again over time, please don't remove it - default : return id; +#define REGISTER_DECODER(X, x) \ + { \ + extern AVCodec ff_##x##_decoder; \ + if (CONFIG_##X##_DECODER) \ + avcodec_register(&ff_##x##_decoder); \ } -} - -static AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *)) -{ - const AVCodec *p, *experimental = NULL; - void *i = 0; - id = remap_deprecated_codec_id(id); +#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x) - while ((p = av_codec_iterate(&i))) { - if (!x(p)) - continue; - if (p->id == id) { - if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) { - experimental = p; - } else - return (AVCodec*)p; - } +#define REGISTER_PARSER(X, x) \ + { \ + extern AVCodecParser ff_##x##_parser; \ + if (CONFIG_##X##_PARSER) \ + av_register_codec_parser(&ff_##x##_parser); \ } - return (AVCodec*)experimental; -} - -AVCodec *avcodec_find_encoder(enum AVCodecID id) -{ - return find_codec(id, av_codec_is_encoder); -} - -AVCodec *avcodec_find_decoder(enum AVCodecID id) +static void register_all(void) { - return find_codec(id, av_codec_is_decoder); -} - -static AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *)) -{ - void *i = 0; - const AVCodec *p; - - if (!name) - return NULL; - - while ((p = av_codec_iterate(&i))) { - if (!x(p)) - continue; - if (strcmp(name, p->name) == 0) - return (AVCodec*)p; - } - - return NULL; + /* hardware accelerators */ + REGISTER_HWACCEL(H263_VAAPI, h263_vaapi); + REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox); + REGISTER_HWACCEL(H264_CUVID, h264_cuvid); + REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va); + REGISTER_HWACCEL(H264_D3D11VA2, h264_d3d11va2); + REGISTER_HWACCEL(H264_DXVA2, h264_dxva2); + REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec); + REGISTER_HWACCEL(H264_MMAL, h264_mmal); + REGISTER_HWACCEL(H264_QSV, h264_qsv); + REGISTER_HWACCEL(H264_VAAPI, h264_vaapi); + REGISTER_HWACCEL(H264_VDA, h264_vda); + REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old); + REGISTER_HWACCEL(H264_VDPAU, h264_vdpau); + REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox); + REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid); + REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va); + REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2); + REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2); + REGISTER_HWACCEL(HEVC_MEDIACODEC, hevc_mediacodec); + REGISTER_HWACCEL(HEVC_QSV, hevc_qsv); + REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi); + REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau); + REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox); + REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid); + REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid); + REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc); + REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); + REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox); + REGISTER_HWACCEL(MPEG2_CUVID, mpeg2_cuvid); + REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc); + REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va); + REGISTER_HWACCEL(MPEG2_D3D11VA2, mpeg2_d3d11va2); + REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2); + REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal); + REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv); + REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi); + REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau); + REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox); + REGISTER_HWACCEL(MPEG2_MEDIACODEC, mpeg2_mediacodec); + REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid); + REGISTER_HWACCEL(MPEG4_MEDIACODEC, mpeg4_mediacodec); + REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal); + REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi); + REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau); + REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox); + REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid); + REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va); + REGISTER_HWACCEL(VC1_D3D11VA2, vc1_d3d11va2); + REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2); + REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi); + REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau); + REGISTER_HWACCEL(VC1_MMAL, vc1_mmal); + REGISTER_HWACCEL(VC1_QSV, vc1_qsv); + REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid); + REGISTER_HWACCEL(VP8_MEDIACODEC, vp8_mediacodec); + REGISTER_HWACCEL(VP8_QSV, vp8_qsv); + REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid); + REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va); + REGISTER_HWACCEL(VP9_D3D11VA2, vp9_d3d11va2); + REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2); + REGISTER_HWACCEL(VP9_MEDIACODEC, vp9_mediacodec); + REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi); + REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va); + REGISTER_HWACCEL(WMV3_D3D11VA2, wmv3_d3d11va2); + REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2); + REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi); + REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau); + + /* video codecs */ + REGISTER_ENCODER(A64MULTI, a64multi); + REGISTER_ENCODER(A64MULTI5, a64multi5); + REGISTER_DECODER(AASC, aasc); + REGISTER_DECODER(AIC, aic); + REGISTER_ENCDEC (ALIAS_PIX, alias_pix); + REGISTER_ENCDEC (AMV, amv); + REGISTER_DECODER(ANM, anm); + REGISTER_DECODER(ANSI, ansi); + REGISTER_ENCDEC (APNG, apng); + REGISTER_ENCDEC (ASV1, asv1); + REGISTER_ENCDEC (ASV2, asv2); + REGISTER_DECODER(AURA, aura); + REGISTER_DECODER(AURA2, aura2); + REGISTER_ENCDEC (AVRP, avrp); + REGISTER_DECODER(AVRN, avrn); + REGISTER_DECODER(AVS, avs); + REGISTER_ENCDEC (AVUI, avui); + REGISTER_ENCDEC (AYUV, ayuv); + REGISTER_DECODER(BETHSOFTVID, bethsoftvid); + REGISTER_DECODER(BFI, bfi); + REGISTER_DECODER(BINK, bink); + REGISTER_ENCDEC (BMP, bmp); + REGISTER_DECODER(BMV_VIDEO, bmv_video); + REGISTER_DECODER(BRENDER_PIX, brender_pix); + REGISTER_DECODER(C93, c93); + REGISTER_DECODER(CAVS, cavs); + REGISTER_DECODER(CDGRAPHICS, cdgraphics); + REGISTER_DECODER(CDXL, cdxl); + REGISTER_DECODER(CFHD, cfhd); + REGISTER_ENCDEC (CINEPAK, cinepak); + REGISTER_DECODER(CLEARVIDEO, clearvideo); + REGISTER_ENCDEC (CLJR, cljr); + REGISTER_DECODER(CLLC, cllc); + REGISTER_ENCDEC (COMFORTNOISE, comfortnoise); + REGISTER_DECODER(CPIA, cpia); + REGISTER_DECODER(CSCD, cscd); + REGISTER_DECODER(CYUV, cyuv); + REGISTER_DECODER(DDS, dds); + REGISTER_DECODER(DFA, dfa); + REGISTER_DECODER(DIRAC, dirac); + REGISTER_ENCDEC (DNXHD, dnxhd); + REGISTER_ENCDEC (DPX, dpx); + REGISTER_DECODER(DSICINVIDEO, dsicinvideo); + REGISTER_DECODER(DVAUDIO, dvaudio); + REGISTER_ENCDEC (DVVIDEO, dvvideo); + REGISTER_DECODER(DXA, dxa); + REGISTER_DECODER(DXTORY, dxtory); + REGISTER_DECODER(DXV, dxv); + REGISTER_DECODER(EACMV, eacmv); + REGISTER_DECODER(EAMAD, eamad); + REGISTER_DECODER(EATGQ, eatgq); + REGISTER_DECODER(EATGV, eatgv); + REGISTER_DECODER(EATQI, eatqi); + REGISTER_DECODER(EIGHTBPS, eightbps); + REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp); + REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib); + REGISTER_DECODER(ESCAPE124, escape124); + REGISTER_DECODER(ESCAPE130, escape130); + REGISTER_DECODER(EXR, exr); + REGISTER_ENCDEC (FFV1, ffv1); + REGISTER_ENCDEC (FFVHUFF, ffvhuff); + REGISTER_DECODER(FIC, fic); + REGISTER_ENCDEC (FITS, fits); + REGISTER_ENCDEC (FLASHSV, flashsv); + REGISTER_ENCDEC (FLASHSV2, flashsv2); + REGISTER_DECODER(FLIC, flic); + REGISTER_ENCDEC (FLV, flv); + REGISTER_DECODER(FMVC, fmvc); + REGISTER_DECODER(FOURXM, fourxm); + REGISTER_DECODER(FRAPS, fraps); + REGISTER_DECODER(FRWU, frwu); + REGISTER_DECODER(G2M, g2m); + REGISTER_DECODER(GDV, gdv); + REGISTER_ENCDEC (GIF, gif); + REGISTER_ENCDEC (H261, h261); + REGISTER_ENCDEC (H263, h263); + REGISTER_DECODER(H263I, h263i); + REGISTER_ENCDEC (H263P, h263p); + REGISTER_DECODER(H263_V4L2M2M, h263_v4l2m2m); + REGISTER_DECODER(H264, h264); + REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd); + REGISTER_DECODER(H264_V4L2M2M, h264_v4l2m2m); + REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec); + REGISTER_DECODER(H264_MMAL, h264_mmal); + REGISTER_DECODER(H264_QSV, h264_qsv); + REGISTER_DECODER(H264_RKMPP, h264_rkmpp); + REGISTER_DECODER(H264_VDA, h264_vda); +#if FF_API_VDPAU + REGISTER_DECODER(H264_VDPAU, h264_vdpau); +#endif + REGISTER_ENCDEC (HAP, hap); + REGISTER_DECODER(HEVC, hevc); + REGISTER_DECODER(HEVC_QSV, hevc_qsv); + REGISTER_DECODER(HEVC_RKMPP, hevc_rkmpp); + REGISTER_DECODER(HEVC_V4L2M2M, hevc_v4l2m2m); + REGISTER_DECODER(HNM4_VIDEO, hnm4_video); + REGISTER_DECODER(HQ_HQA, hq_hqa); + REGISTER_DECODER(HQX, hqx); + REGISTER_ENCDEC (HUFFYUV, huffyuv); + REGISTER_DECODER(IDCIN, idcin); + REGISTER_DECODER(IFF_ILBM, iff_ilbm); + REGISTER_DECODER(INDEO2, indeo2); + REGISTER_DECODER(INDEO3, indeo3); + REGISTER_DECODER(INDEO4, indeo4); + REGISTER_DECODER(INDEO5, indeo5); + REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video); + REGISTER_ENCDEC (JPEG2000, jpeg2000); + REGISTER_ENCDEC (JPEGLS, jpegls); + REGISTER_DECODER(JV, jv); + REGISTER_DECODER(KGV1, kgv1); + REGISTER_DECODER(KMVC, kmvc); + REGISTER_DECODER(LAGARITH, lagarith); + REGISTER_ENCODER(LJPEG, ljpeg); + REGISTER_DECODER(LOCO, loco); + REGISTER_DECODER(M101, m101); + REGISTER_DECODER(MAGICYUV, magicyuv); + REGISTER_DECODER(MDEC, mdec); + REGISTER_DECODER(MIMIC, mimic); + REGISTER_ENCDEC (MJPEG, mjpeg); + REGISTER_DECODER(MJPEGB, mjpegb); + REGISTER_DECODER(MMVIDEO, mmvideo); + REGISTER_DECODER(MOTIONPIXELS, motionpixels); +#if FF_API_XVMC + REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc); +#endif /* FF_API_XVMC */ + REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); + REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); + REGISTER_ENCDEC (MPEG4, mpeg4); + REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd); + REGISTER_DECODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m); + REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal); +#if FF_API_VDPAU + REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau); +#endif + REGISTER_DECODER(MPEGVIDEO, mpegvideo); +#if FF_API_VDPAU + REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau); + REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau); +#endif + REGISTER_DECODER(MPEG1_V4L2M2M, mpeg1_v4l2m2m); + REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal); + REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd); + REGISTER_DECODER(MPEG2_V4L2M2M, mpeg2_v4l2m2m); + REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv); + REGISTER_DECODER(MPEG2_MEDIACODEC, mpeg2_mediacodec); + REGISTER_DECODER(MSA1, msa1); + REGISTER_DECODER(MSCC, mscc); + REGISTER_DECODER(MSMPEG4V1, msmpeg4v1); + REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2); + REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3); + REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd); + REGISTER_DECODER(MSRLE, msrle); + REGISTER_DECODER(MSS1, mss1); + REGISTER_DECODER(MSS2, mss2); + REGISTER_ENCDEC (MSVIDEO1, msvideo1); + REGISTER_DECODER(MSZH, mszh); + REGISTER_DECODER(MTS2, mts2); + REGISTER_DECODER(MVC1, mvc1); + REGISTER_DECODER(MVC2, mvc2); + REGISTER_DECODER(MXPEG, mxpeg); + REGISTER_DECODER(NUV, nuv); + REGISTER_DECODER(PAF_VIDEO, paf_video); + REGISTER_ENCDEC (PAM, pam); + REGISTER_ENCDEC (PBM, pbm); + REGISTER_ENCDEC (PCX, pcx); + REGISTER_ENCDEC (PGM, pgm); + REGISTER_ENCDEC (PGMYUV, pgmyuv); + REGISTER_DECODER(PICTOR, pictor); + REGISTER_DECODER(PIXLET, pixlet); + REGISTER_ENCDEC (PNG, png); + REGISTER_ENCDEC (PPM, ppm); + REGISTER_ENCDEC (PRORES, prores); + REGISTER_ENCODER(PRORES_AW, prores_aw); + REGISTER_ENCODER(PRORES_KS, prores_ks); + REGISTER_DECODER(PRORES_LGPL, prores_lgpl); + REGISTER_DECODER(PSD, psd); + REGISTER_DECODER(PTX, ptx); + REGISTER_DECODER(QDRAW, qdraw); + REGISTER_DECODER(QPEG, qpeg); + REGISTER_ENCDEC (QTRLE, qtrle); + REGISTER_ENCDEC (R10K, r10k); + REGISTER_ENCDEC (R210, r210); + REGISTER_ENCDEC (RAWVIDEO, rawvideo); + REGISTER_DECODER(RL2, rl2); + REGISTER_ENCDEC (ROQ, roq); + REGISTER_DECODER(RPZA, rpza); + REGISTER_DECODER(RSCC, rscc); + REGISTER_ENCDEC (RV10, rv10); + REGISTER_ENCDEC (RV20, rv20); + REGISTER_DECODER(RV30, rv30); + REGISTER_DECODER(RV40, rv40); + REGISTER_ENCDEC (S302M, s302m); + REGISTER_DECODER(SANM, sanm); + REGISTER_DECODER(SCPR, scpr); + REGISTER_DECODER(SCREENPRESSO, screenpresso); + REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm); + REGISTER_ENCDEC (SGI, sgi); + REGISTER_DECODER(SGIRLE, sgirle); + REGISTER_DECODER(SHEERVIDEO, sheervideo); + REGISTER_DECODER(SMACKER, smacker); + REGISTER_DECODER(SMC, smc); + REGISTER_DECODER(SMVJPEG, smvjpeg); + REGISTER_ENCDEC (SNOW, snow); + REGISTER_DECODER(SP5X, sp5x); + REGISTER_DECODER(SPEEDHQ, speedhq); + REGISTER_DECODER(SRGC, srgc); + REGISTER_ENCDEC (SUNRAST, sunrast); + REGISTER_ENCDEC (SVQ1, svq1); + REGISTER_DECODER(SVQ3, svq3); + REGISTER_ENCDEC (TARGA, targa); + REGISTER_DECODER(TARGA_Y216, targa_y216); + REGISTER_DECODER(TDSC, tdsc); + REGISTER_DECODER(THEORA, theora); + REGISTER_DECODER(THP, thp); + REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo); + REGISTER_ENCDEC (TIFF, tiff); + REGISTER_DECODER(TMV, tmv); + REGISTER_DECODER(TRUEMOTION1, truemotion1); + REGISTER_DECODER(TRUEMOTION2, truemotion2); + REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt); + REGISTER_DECODER(TSCC, tscc); + REGISTER_DECODER(TSCC2, tscc2); + REGISTER_DECODER(TXD, txd); + REGISTER_DECODER(ULTI, ulti); + REGISTER_ENCDEC (UTVIDEO, utvideo); + REGISTER_ENCDEC (V210, v210); + REGISTER_DECODER(V210X, v210x); + REGISTER_ENCDEC (V308, v308); + REGISTER_ENCDEC (V408, v408); + REGISTER_ENCDEC (V410, v410); + REGISTER_DECODER(VB, vb); + REGISTER_DECODER(VBLE, vble); + REGISTER_DECODER(VC1, vc1); + REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd); +#if FF_API_VDPAU + REGISTER_DECODER(VC1_VDPAU, vc1_vdpau); +#endif + REGISTER_DECODER(VC1IMAGE, vc1image); + REGISTER_DECODER(VC1_MMAL, vc1_mmal); + REGISTER_DECODER(VC1_QSV, vc1_qsv); + REGISTER_DECODER(VC1_V4L2M2M, vc1_v4l2m2m); + REGISTER_ENCODER(VC2, vc2); + REGISTER_DECODER(VCR1, vcr1); + REGISTER_DECODER(VMDVIDEO, vmdvideo); + REGISTER_DECODER(VMNC, vmnc); + REGISTER_DECODER(VP3, vp3); + REGISTER_DECODER(VP5, vp5); + REGISTER_DECODER(VP6, vp6); + REGISTER_DECODER(VP6A, vp6a); + REGISTER_DECODER(VP6F, vp6f); + REGISTER_DECODER(VP7, vp7); + REGISTER_DECODER(VP8, vp8); + REGISTER_DECODER(VP8_RKMPP, vp8_rkmpp); + REGISTER_DECODER(VP8_V4L2M2M, vp8_v4l2m2m); + REGISTER_DECODER(VP9, vp9); + REGISTER_DECODER(VP9_RKMPP, vp9_rkmpp); + REGISTER_DECODER(VP9_V4L2M2M, vp9_v4l2m2m); + REGISTER_DECODER(VQA, vqa); + REGISTER_DECODER(BITPACKED, bitpacked); + REGISTER_DECODER(WEBP, webp); + REGISTER_ENCDEC (WRAPPED_AVFRAME, wrapped_avframe); + REGISTER_ENCDEC (WMV1, wmv1); + REGISTER_ENCDEC (WMV2, wmv2); + REGISTER_DECODER(WMV3, wmv3); + REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd); +#if FF_API_VDPAU + REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau); +#endif + REGISTER_DECODER(WMV3IMAGE, wmv3image); + REGISTER_DECODER(WNV1, wnv1); + REGISTER_DECODER(XAN_WC3, xan_wc3); + REGISTER_DECODER(XAN_WC4, xan_wc4); + REGISTER_ENCDEC (XBM, xbm); + REGISTER_ENCDEC (XFACE, xface); + REGISTER_DECODER(XL, xl); + REGISTER_DECODER(XPM, xpm); + REGISTER_ENCDEC (XWD, xwd); + REGISTER_ENCDEC (Y41P, y41p); + REGISTER_DECODER(YLC, ylc); + REGISTER_DECODER(YOP, yop); + REGISTER_ENCDEC (YUV4, yuv4); + REGISTER_DECODER(ZERO12V, zero12v); + REGISTER_DECODER(ZEROCODEC, zerocodec); + REGISTER_ENCDEC (ZLIB, zlib); + REGISTER_ENCDEC (ZMBV, zmbv); + + /* audio codecs */ + REGISTER_ENCDEC (AAC, aac); + REGISTER_DECODER(AAC_FIXED, aac_fixed); + REGISTER_DECODER(AAC_LATM, aac_latm); + REGISTER_ENCDEC (AC3, ac3); + REGISTER_ENCDEC (AC3_FIXED, ac3_fixed); + REGISTER_ENCDEC (ALAC, alac); + REGISTER_DECODER(ALS, als); + REGISTER_DECODER(AMRNB, amrnb); + REGISTER_DECODER(AMRWB, amrwb); + REGISTER_DECODER(APE, ape); + REGISTER_DECODER(ATRAC1, atrac1); + REGISTER_DECODER(ATRAC3, atrac3); + REGISTER_DECODER(ATRAC3AL, atrac3al); + REGISTER_DECODER(ATRAC3P, atrac3p); + REGISTER_DECODER(ATRAC3PAL, atrac3pal); + REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct); + REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft); + REGISTER_DECODER(BMV_AUDIO, bmv_audio); + REGISTER_DECODER(COOK, cook); + REGISTER_ENCDEC (DCA, dca); + REGISTER_DECODER(DOLBY_E, dolby_e); + REGISTER_DECODER(DSD_LSBF, dsd_lsbf); + REGISTER_DECODER(DSD_MSBF, dsd_msbf); + REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar); + REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar); + REGISTER_DECODER(DSICINAUDIO, dsicinaudio); + REGISTER_DECODER(DSS_SP, dss_sp); + REGISTER_DECODER(DST, dst); + REGISTER_ENCDEC (EAC3, eac3); + REGISTER_DECODER(EVRC, evrc); + REGISTER_DECODER(FFWAVESYNTH, ffwavesynth); + REGISTER_ENCDEC (FLAC, flac); + REGISTER_ENCDEC (G723_1, g723_1); + REGISTER_DECODER(G729, g729); + REGISTER_DECODER(GSM, gsm); + REGISTER_DECODER(GSM_MS, gsm_ms); + REGISTER_DECODER(IAC, iac); + REGISTER_DECODER(IMC, imc); + REGISTER_DECODER(INTERPLAY_ACM, interplay_acm); + REGISTER_DECODER(MACE3, mace3); + REGISTER_DECODER(MACE6, mace6); + REGISTER_DECODER(METASOUND, metasound); + REGISTER_ENCDEC (MLP, mlp); + REGISTER_DECODER(MP1, mp1); + REGISTER_DECODER(MP1FLOAT, mp1float); + REGISTER_ENCDEC (MP2, mp2); + REGISTER_DECODER(MP2FLOAT, mp2float); + REGISTER_ENCODER(MP2FIXED, mp2fixed); + REGISTER_DECODER(MP3, mp3); + REGISTER_DECODER(MP3FLOAT, mp3float); + REGISTER_DECODER(MP3ADU, mp3adu); + REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat); + REGISTER_DECODER(MP3ON4, mp3on4); + REGISTER_DECODER(MP3ON4FLOAT, mp3on4float); + REGISTER_DECODER(MPC7, mpc7); + REGISTER_DECODER(MPC8, mpc8); + REGISTER_ENCDEC (NELLYMOSER, nellymoser); + REGISTER_DECODER(ON2AVC, on2avc); + REGISTER_ENCDEC (OPUS, opus); + REGISTER_DECODER(PAF_AUDIO, paf_audio); + REGISTER_DECODER(QCELP, qcelp); + REGISTER_DECODER(QDM2, qdm2); + REGISTER_DECODER(QDMC, qdmc); + REGISTER_ENCDEC (RA_144, ra_144); + REGISTER_DECODER(RA_288, ra_288); + REGISTER_DECODER(RALF, ralf); + REGISTER_DECODER(SHORTEN, shorten); + REGISTER_DECODER(SIPR, sipr); + REGISTER_DECODER(SMACKAUD, smackaud); + REGISTER_ENCDEC (SONIC, sonic); + REGISTER_ENCODER(SONIC_LS, sonic_ls); + REGISTER_DECODER(TAK, tak); + REGISTER_ENCDEC (TRUEHD, truehd); + REGISTER_DECODER(TRUESPEECH, truespeech); + REGISTER_ENCDEC (TTA, tta); + REGISTER_DECODER(TWINVQ, twinvq); + REGISTER_DECODER(VMDAUDIO, vmdaudio); + REGISTER_ENCDEC (VORBIS, vorbis); + REGISTER_ENCDEC (WAVPACK, wavpack); + REGISTER_DECODER(WMALOSSLESS, wmalossless); + REGISTER_DECODER(WMAPRO, wmapro); + REGISTER_ENCDEC (WMAV1, wmav1); + REGISTER_ENCDEC (WMAV2, wmav2); + REGISTER_DECODER(WMAVOICE, wmavoice); + REGISTER_DECODER(WS_SND1, ws_snd1); + REGISTER_DECODER(XMA1, xma1); + REGISTER_DECODER(XMA2, xma2); + + /* PCM codecs */ + REGISTER_ENCDEC (PCM_ALAW, pcm_alaw); + REGISTER_DECODER(PCM_BLURAY, pcm_bluray); + REGISTER_DECODER(PCM_DVD, pcm_dvd); + REGISTER_DECODER(PCM_F16LE, pcm_f16le); + REGISTER_DECODER(PCM_F24LE, pcm_f24le); + REGISTER_ENCDEC (PCM_F32BE, pcm_f32be); + REGISTER_ENCDEC (PCM_F32LE, pcm_f32le); + REGISTER_ENCDEC (PCM_F64BE, pcm_f64be); + REGISTER_ENCDEC (PCM_F64LE, pcm_f64le); + REGISTER_DECODER(PCM_LXF, pcm_lxf); + REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw); + REGISTER_ENCDEC (PCM_S8, pcm_s8); + REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar); + REGISTER_ENCDEC (PCM_S16BE, pcm_s16be); + REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar); + REGISTER_ENCDEC (PCM_S16LE, pcm_s16le); + REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar); + REGISTER_ENCDEC (PCM_S24BE, pcm_s24be); + REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud); + REGISTER_ENCDEC (PCM_S24LE, pcm_s24le); + REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar); + REGISTER_ENCDEC (PCM_S32BE, pcm_s32be); + REGISTER_ENCDEC (PCM_S32LE, pcm_s32le); + REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar); + REGISTER_ENCDEC (PCM_S64BE, pcm_s64be); + REGISTER_ENCDEC (PCM_S64LE, pcm_s64le); + REGISTER_ENCDEC (PCM_U8, pcm_u8); + REGISTER_ENCDEC (PCM_U16BE, pcm_u16be); + REGISTER_ENCDEC (PCM_U16LE, pcm_u16le); + REGISTER_ENCDEC (PCM_U24BE, pcm_u24be); + REGISTER_ENCDEC (PCM_U24LE, pcm_u24le); + REGISTER_ENCDEC (PCM_U32BE, pcm_u32be); + REGISTER_ENCDEC (PCM_U32LE, pcm_u32le); + REGISTER_DECODER(PCM_ZORK, pcm_zork); + + /* DPCM codecs */ + REGISTER_DECODER(GREMLIN_DPCM, gremlin_dpcm); + REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm); + REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm); + REGISTER_DECODER(SOL_DPCM, sol_dpcm); + REGISTER_DECODER(XAN_DPCM, xan_dpcm); + + /* ADPCM codecs */ + REGISTER_DECODER(ADPCM_4XM, adpcm_4xm); + REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx); + REGISTER_DECODER(ADPCM_AFC, adpcm_afc); + REGISTER_DECODER(ADPCM_AICA, adpcm_aica); + REGISTER_DECODER(ADPCM_CT, adpcm_ct); + REGISTER_DECODER(ADPCM_DTK, adpcm_dtk); + REGISTER_DECODER(ADPCM_EA, adpcm_ea); + REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa); + REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1); + REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2); + REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3); + REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas); + REGISTER_ENCDEC (ADPCM_G722, adpcm_g722); + REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); + REGISTER_ENCDEC (ADPCM_G726LE, adpcm_g726le); + REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv); + REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc); + REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4); + REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3); + REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4); + REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs); + REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead); + REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss); + REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki); + REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt); + REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad); + REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg); + REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav); + REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws); + REGISTER_ENCDEC (ADPCM_MS, adpcm_ms); + REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf); + REGISTER_DECODER(ADPCM_PSX, adpcm_psx); + REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2); + REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3); + REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4); + REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf); + REGISTER_DECODER(ADPCM_THP, adpcm_thp); + REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le); + REGISTER_DECODER(ADPCM_VIMA, adpcm_vima); + REGISTER_DECODER(ADPCM_XA, adpcm_xa); + REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha); + + /* subtitles */ + REGISTER_ENCDEC (SSA, ssa); + REGISTER_ENCDEC (ASS, ass); + REGISTER_DECODER(CCAPTION, ccaption); + REGISTER_ENCDEC (DVBSUB, dvbsub); + REGISTER_ENCDEC (DVDSUB, dvdsub); + REGISTER_DECODER(JACOSUB, jacosub); + REGISTER_DECODER(MICRODVD, microdvd); + REGISTER_ENCDEC (MOVTEXT, movtext); + REGISTER_DECODER(MPL2, mpl2); + REGISTER_DECODER(PGSSUB, pgssub); + REGISTER_DECODER(PJS, pjs); + REGISTER_DECODER(REALTEXT, realtext); + REGISTER_DECODER(SAMI, sami); + REGISTER_ENCDEC (SRT, srt); + REGISTER_DECODER(STL, stl); + REGISTER_ENCDEC (SUBRIP, subrip); + REGISTER_DECODER(SUBVIEWER, subviewer); + REGISTER_DECODER(SUBVIEWER1, subviewer1); + REGISTER_ENCDEC (TEXT, text); + REGISTER_DECODER(VPLAYER, vplayer); + REGISTER_ENCDEC (WEBVTT, webvtt); + REGISTER_ENCDEC (XSUB, xsub); + + /* external libraries */ + REGISTER_ENCDEC (AAC_AT, aac_at); + REGISTER_DECODER(AC3_AT, ac3_at); + REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at); + REGISTER_ENCDEC (ALAC_AT, alac_at); + REGISTER_DECODER(AMR_NB_AT, amr_nb_at); + REGISTER_DECODER(EAC3_AT, eac3_at); + REGISTER_DECODER(GSM_MS_AT, gsm_ms_at); + REGISTER_ENCDEC (ILBC_AT, ilbc_at); + REGISTER_DECODER(MP1_AT, mp1_at); + REGISTER_DECODER(MP2_AT, mp2_at); + REGISTER_DECODER(MP3_AT, mp3_at); + REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at); + REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at); + REGISTER_DECODER(QDMC_AT, qdmc_at); + REGISTER_DECODER(QDM2_AT, qdm2_at); + REGISTER_DECODER(LIBCELT, libcelt); + REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac); + REGISTER_ENCDEC (LIBGSM, libgsm); + REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms); + REGISTER_ENCDEC (LIBILBC, libilbc); + REGISTER_ENCODER(LIBMP3LAME, libmp3lame); + REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb); + REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb); + REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg); + REGISTER_ENCDEC (LIBOPUS, libopus); + REGISTER_DECODER(LIBRSVG, librsvg); + REGISTER_ENCODER(LIBSHINE, libshine); + REGISTER_ENCDEC (LIBSPEEX, libspeex); + REGISTER_ENCODER(LIBTHEORA, libtheora); + REGISTER_ENCODER(LIBTWOLAME, libtwolame); + REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc); + REGISTER_ENCDEC (LIBVORBIS, libvorbis); + REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8); + REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9); + REGISTER_ENCODER(LIBWAVPACK, libwavpack); + REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim); /* preferred over libwebp */ + REGISTER_ENCODER(LIBWEBP, libwebp); + REGISTER_ENCODER(LIBX262, libx262); + REGISTER_ENCODER(LIBX264, libx264); + REGISTER_ENCODER(LIBX264RGB, libx264rgb); + REGISTER_ENCODER(LIBX265, libx265); + REGISTER_ENCODER(LIBXAVS, libxavs); + REGISTER_ENCODER(LIBXVID, libxvid); + REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext); + + /* text */ + REGISTER_DECODER(BINTEXT, bintext); + REGISTER_DECODER(XBIN, xbin); + REGISTER_DECODER(IDF, idf); + + /* external libraries, that shouldn't be used by default if one of the + * above is available */ + REGISTER_ENCODER(H263_V4L2M2M, h263_v4l2m2m); + REGISTER_ENCDEC (LIBOPENH264, libopenh264); + REGISTER_DECODER(H264_CUVID, h264_cuvid); + REGISTER_ENCODER(H264_NVENC, h264_nvenc); + REGISTER_ENCODER(H264_OMX, h264_omx); + REGISTER_ENCODER(H264_QSV, h264_qsv); + REGISTER_ENCODER(H264_V4L2M2M, h264_v4l2m2m); + REGISTER_ENCODER(H264_VAAPI, h264_vaapi); + REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox); +#if FF_API_NVENC_OLD_NAME + REGISTER_ENCODER(NVENC, nvenc); + REGISTER_ENCODER(NVENC_H264, nvenc_h264); + REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc); +#endif + REGISTER_DECODER(HEVC_CUVID, hevc_cuvid); + REGISTER_DECODER(HEVC_MEDIACODEC, hevc_mediacodec); + REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc); + REGISTER_ENCODER(HEVC_QSV, hevc_qsv); + REGISTER_ENCODER(HEVC_V4L2M2M, hevc_v4l2m2m); + REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi); + REGISTER_ENCODER(LIBKVAZAAR, libkvazaar); + REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid); + REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi); + REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid); + REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid); + REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); + REGISTER_ENCODER(MPEG2_VAAPI, mpeg2_vaapi); + REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid); + REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec); + REGISTER_ENCODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m); + REGISTER_DECODER(VC1_CUVID, vc1_cuvid); + REGISTER_DECODER(VP8_CUVID, vp8_cuvid); + REGISTER_DECODER(VP8_MEDIACODEC, vp8_mediacodec); + REGISTER_DECODER(VP8_QSV, vp8_qsv); + REGISTER_ENCODER(VP8_V4L2M2M, vp8_v4l2m2m); + REGISTER_ENCODER(VP8_VAAPI, vp8_vaapi); + REGISTER_DECODER(VP9_CUVID, vp9_cuvid); + REGISTER_DECODER(VP9_MEDIACODEC, vp9_mediacodec); + REGISTER_ENCODER(VP9_VAAPI, vp9_vaapi); + + /* parsers */ + REGISTER_PARSER(AAC, aac); + REGISTER_PARSER(AAC_LATM, aac_latm); + REGISTER_PARSER(AC3, ac3); + REGISTER_PARSER(ADX, adx); + REGISTER_PARSER(BMP, bmp); + REGISTER_PARSER(CAVSVIDEO, cavsvideo); + REGISTER_PARSER(COOK, cook); + REGISTER_PARSER(DCA, dca); + REGISTER_PARSER(DIRAC, dirac); + REGISTER_PARSER(DNXHD, dnxhd); + REGISTER_PARSER(DPX, dpx); + REGISTER_PARSER(DVAUDIO, dvaudio); + REGISTER_PARSER(DVBSUB, dvbsub); + REGISTER_PARSER(DVDSUB, dvdsub); + REGISTER_PARSER(DVD_NAV, dvd_nav); + REGISTER_PARSER(FLAC, flac); + REGISTER_PARSER(G729, g729); + REGISTER_PARSER(GSM, gsm); + REGISTER_PARSER(H261, h261); + REGISTER_PARSER(H263, h263); + REGISTER_PARSER(H264, h264); + REGISTER_PARSER(HEVC, hevc); + REGISTER_PARSER(MJPEG, mjpeg); + REGISTER_PARSER(MLP, mlp); + REGISTER_PARSER(MPEG4VIDEO, mpeg4video); + REGISTER_PARSER(MPEGAUDIO, mpegaudio); + REGISTER_PARSER(MPEGVIDEO, mpegvideo); + REGISTER_PARSER(OPUS, opus); + REGISTER_PARSER(PNG, png); + REGISTER_PARSER(PNM, pnm); + REGISTER_PARSER(RV30, rv30); + REGISTER_PARSER(RV40, rv40); + REGISTER_PARSER(SIPR, sipr); + REGISTER_PARSER(TAK, tak); + REGISTER_PARSER(VC1, vc1); + REGISTER_PARSER(VORBIS, vorbis); + REGISTER_PARSER(VP3, vp3); + REGISTER_PARSER(VP8, vp8); + REGISTER_PARSER(VP9, vp9); + REGISTER_PARSER(XMA, xma); } -AVCodec *avcodec_find_encoder_by_name(const char *name) +void avcodec_register_all(void) { - return find_codec_by_name(name, av_codec_is_encoder); -} + static AVOnce control = AV_ONCE_INIT; -AVCodec *avcodec_find_decoder_by_name(const char *name) -{ - return find_codec_by_name(name, av_codec_is_decoder); + ff_thread_once(&control, register_all); } diff --git a/media/ffvpx/libavcodec/audioconvert.c b/media/ffvpx/libavcodec/audioconvert.c new file mode 100644 index 000000000..5e46fae2d --- /dev/null +++ b/media/ffvpx/libavcodec/audioconvert.c @@ -0,0 +1,120 @@ +/* + * audio conversion + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * audio conversion + * @author Michael Niedermayer <michaelni@gmx.at> + */ + +#include "libavutil/avstring.h" +#include "libavutil/common.h" +#include "libavutil/libm.h" +#include "libavutil/samplefmt.h" +#include "avcodec.h" +#include "audioconvert.h" + +#if FF_API_AUDIO_CONVERT + +struct AVAudioConvert { + int in_channels, out_channels; + int fmt_pair; +}; + +AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels, + enum AVSampleFormat in_fmt, int in_channels, + const float *matrix, int flags) +{ + AVAudioConvert *ctx; + if (in_channels!=out_channels) + return NULL; /* FIXME: not supported */ + ctx = av_malloc(sizeof(AVAudioConvert)); + if (!ctx) + return NULL; + ctx->in_channels = in_channels; + ctx->out_channels = out_channels; + ctx->fmt_pair = out_fmt + AV_SAMPLE_FMT_NB*in_fmt; + return ctx; +} + +void av_audio_convert_free(AVAudioConvert *ctx) +{ + av_free(ctx); +} + +int av_audio_convert(AVAudioConvert *ctx, + void * const out[6], const int out_stride[6], + const void * const in[6], const int in_stride[6], int len) +{ + int ch; + + //FIXME optimize common cases + + for(ch=0; ch<ctx->out_channels; ch++){ + const int is= in_stride[ch]; + const int os= out_stride[ch]; + const uint8_t *pi= in[ch]; + uint8_t *po= out[ch]; + uint8_t *end= po + os*len; + if(!out[ch]) + continue; + +#define CONV(ofmt, otype, ifmt, expr)\ +if(ctx->fmt_pair == ofmt + AV_SAMPLE_FMT_NB*ifmt){\ + do{\ + *(otype*)po = expr; pi += is; po += os;\ + }while(po < end);\ +} + +//FIXME put things below under ifdefs so we do not waste space for cases no codec will need +//FIXME rounding ? + + CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_U8 , *(const uint8_t*)pi) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<8) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<24) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7))) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7))) + else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi<<16) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15))) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15))) + else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S32, (*(const int32_t*)pi>>24) + 0x80) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi>>16) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1U<<31))) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1U<<31))) + else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8( lrintf(*(const float*)pi * (1<<7)) + 0x80)) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16( lrintf(*(const float*)pi * (1<<15)))) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float*)pi * (1U<<31)))) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_FLT, *(const float*)pi) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_FLT, *(const float*)pi) + else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8( lrint(*(const double*)pi * (1<<7)) + 0x80)) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16( lrint(*(const double*)pi * (1<<15)))) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double*)pi * (1U<<31)))) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_DBL, *(const double*)pi) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_DBL, *(const double*)pi) + else return -1; + } + return 0; +} + +#endif /* FF_API_AUDIO_CONVERT */ diff --git a/media/ffvpx/libavcodec/audioconvert.h b/media/ffvpx/libavcodec/audioconvert.h new file mode 100644 index 000000000..996c3f37a --- /dev/null +++ b/media/ffvpx/libavcodec/audioconvert.h @@ -0,0 +1,86 @@ +/* + * audio conversion + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * Copyright (c) 2008 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AUDIOCONVERT_H +#define AVCODEC_AUDIOCONVERT_H + +#include "version.h" + +/** + * @file + * Audio format conversion routines + * This interface is deprecated and will be dropped in a future + * version. You should use the libswresample library instead. + */ + +#if FF_API_AUDIO_CONVERT + +#include "libavutil/cpu.h" +#include "avcodec.h" +#include "libavutil/channel_layout.h" + +struct AVAudioConvert; +typedef struct AVAudioConvert AVAudioConvert; + +/** + * Create an audio sample format converter context + * @param out_fmt Output sample format + * @param out_channels Number of output channels + * @param in_fmt Input sample format + * @param in_channels Number of input channels + * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore. + * @param flags See AV_CPU_FLAG_xx + * @return NULL on error + * @deprecated See libswresample + */ + +attribute_deprecated +AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels, + enum AVSampleFormat in_fmt, int in_channels, + const float *matrix, int flags); + +/** + * Free audio sample format converter context + * @deprecated See libswresample + */ + +attribute_deprecated +void av_audio_convert_free(AVAudioConvert *ctx); + +/** + * Convert between audio sample formats + * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel. + * @param[in] out_stride distance between consecutive output samples (measured in bytes) + * @param[in] in array of input buffers for each channel + * @param[in] in_stride distance between consecutive input samples (measured in bytes) + * @param len length of audio frame size (measured in samples) + * @deprecated See libswresample + */ + +attribute_deprecated +int av_audio_convert(AVAudioConvert *ctx, + void * const out[6], const int out_stride[6], + const void * const in[6], const int in_stride[6], int len); + +#endif /* FF_API_AUDIO_CONVERT */ + +#endif /* AVCODEC_AUDIOCONVERT_H */ diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h index fb0c6fae7..18c3e3ea1 100644 --- a/media/ffvpx/libavcodec/avcodec.h +++ b/media/ffvpx/libavcodec/avcodec.h @@ -36,7 +36,6 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/frame.h" -#include "libavutil/hwcontext.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" @@ -218,6 +217,9 @@ enum AVCodecID { /* video codecs */ AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding +#if FF_API_XVMC + AV_CODEC_ID_MPEG2VIDEO_XVMC, +#endif /* FF_API_XVMC */ AV_CODEC_ID_H261, AV_CODEC_ID_H263, AV_CODEC_ID_RV10, @@ -518,6 +520,9 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_VIMA, +#if FF_API_VIMA_DECODER + AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA, +#endif AV_CODEC_ID_ADPCM_AFC = 0x11800, AV_CODEC_ID_ADPCM_IMA_OKI, @@ -580,6 +585,9 @@ enum AVCodecID { AV_CODEC_ID_MLP, AV_CODEC_ID_GSM_MS, /* as found in WAV */ AV_CODEC_ID_ATRAC3, +#if FF_API_VOXWARE + AV_CODEC_ID_VOXWARE, +#endif AV_CODEC_ID_APE, AV_CODEC_ID_NELLYMOSER, AV_CODEC_ID_MUSEPACK8, @@ -615,7 +623,6 @@ enum AVCodecID { AV_CODEC_ID_PAF_AUDIO, AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, - AV_CODEC_ID_CODEC2, AV_CODEC_ID_FFWAVESYNTH = 0x15800, AV_CODEC_ID_SONIC, @@ -634,9 +641,6 @@ enum AVCodecID { AV_CODEC_ID_ATRAC3AL, AV_CODEC_ID_ATRAC3PAL, AV_CODEC_ID_DOLBY_E, - AV_CODEC_ID_APTX, - AV_CODEC_ID_APTX_HD, - AV_CODEC_ID_SBC, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -770,7 +774,7 @@ typedef struct AVCodecDescriptor { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define AV_INPUT_BUFFER_PADDING_SIZE 64 +#define AV_INPUT_BUFFER_PADDING_SIZE 32 /** * @ingroup lavc_encoding @@ -779,6 +783,38 @@ typedef struct AVCodecDescriptor { */ #define AV_INPUT_BUFFER_MIN_SIZE 16384 +#if FF_API_WITHOUT_PREFIX +/** + * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 32 + +/** + * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead + */ +#define FF_MIN_BUFFER_SIZE 16384 +#endif /* FF_API_WITHOUT_PREFIX */ + +/** + * @ingroup lavc_encoding + * motion estimation type. + * @deprecated use codec private option instead + */ +#if FF_API_MOTION_EST +enum Motion_Est_ID { + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_TESA, ///< transformed exhaustive search algorithm + ME_ITER=50, ///< iterative search +}; +#endif + /** * @ingroup lavc_decoding */ @@ -817,6 +853,13 @@ typedef struct RcOverride{ float quality_factor; } RcOverride; +#if FF_API_MAX_BFRAMES +/** + * @deprecated there is no libavcodec-wide limit on the number of B-frames + */ +#define FF_MAX_B_FRAMES 16 +#endif + /* encoding support These flags can be passed in AVCodecContext.flags before initialization. Note: Not everything is supported yet. @@ -988,6 +1031,13 @@ typedef struct RcOverride{ */ #define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define AV_CODEC_CAP_HWACCEL_VDPAU (1 << 7) +#endif + /** * Codec can output multiple frames per AVPacket * Normally demuxers return one frame at a time, demuxers which do not do @@ -1048,26 +1098,231 @@ typedef struct RcOverride{ */ #define AV_CODEC_CAP_LOSSLESS 0x80000000 + +#if FF_API_WITHOUT_PREFIX /** - * Codec is backed by a hardware implementation. Typically used to - * identify a non-hwaccel hardware decoder. For information about hwaccels, use - * avcodec_get_hw_config() instead. + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). */ -#define AV_CODEC_CAP_HARDWARE (1 << 18) +#define CODEC_FLAG_UNALIGNED AV_CODEC_FLAG_UNALIGNED +#define CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE +#define CODEC_FLAG_4MV AV_CODEC_FLAG_4MV +#define CODEC_FLAG_OUTPUT_CORRUPT AV_CODEC_FLAG_OUTPUT_CORRUPT +#define CODEC_FLAG_QPEL AV_CODEC_FLAG_QPEL +#if FF_API_GMC +/** + * @deprecated use the "gmc" private option of the libxvid encoder + */ +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#endif +#if FF_API_MV0 +/** + * @deprecated use the flag "mv0" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_MV0 0x0040 +#endif +#if FF_API_INPUT_PRESERVED +/** + * @deprecated passing reference-counted frames to the encoders replaces this + * flag + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#endif +#define CODEC_FLAG_PASS1 AV_CODEC_FLAG_PASS1 +#define CODEC_FLAG_PASS2 AV_CODEC_FLAG_PASS2 +#define CODEC_FLAG_GRAY AV_CODEC_FLAG_GRAY +#if FF_API_EMU_EDGE +/** + * @deprecated edges are not used/required anymore. I.e. this flag is now always + * set. + */ +#define CODEC_FLAG_EMU_EDGE 0x4000 +#endif +#define CODEC_FLAG_PSNR AV_CODEC_FLAG_PSNR +#define CODEC_FLAG_TRUNCATED AV_CODEC_FLAG_TRUNCATED +#if FF_API_NORMALIZE_AQP /** - * Codec is potentially backed by a hardware implementation, but not - * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the - * implementation provides some sort of internal fallback. + * @deprecated use the flag "naq" in the "mpv_flags" private option of the + * mpegvideo encoders */ -#define AV_CODEC_CAP_HYBRID (1 << 19) +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 +#endif +#define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT +#define CODEC_FLAG_LOW_DELAY AV_CODEC_FLAG_LOW_DELAY +#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER +#define CODEC_FLAG_BITEXACT AV_CODEC_FLAG_BITEXACT +#define CODEC_FLAG_AC_PRED AV_CODEC_FLAG_AC_PRED +#define CODEC_FLAG_LOOP_FILTER AV_CODEC_FLAG_LOOP_FILTER +#define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME +#define CODEC_FLAG_CLOSED_GOP AV_CODEC_FLAG_CLOSED_GOP +#define CODEC_FLAG2_FAST AV_CODEC_FLAG2_FAST +#define CODEC_FLAG2_NO_OUTPUT AV_CODEC_FLAG2_NO_OUTPUT +#define CODEC_FLAG2_LOCAL_HEADER AV_CODEC_FLAG2_LOCAL_HEADER +#define CODEC_FLAG2_DROP_FRAME_TIMECODE AV_CODEC_FLAG2_DROP_FRAME_TIMECODE +#define CODEC_FLAG2_IGNORE_CROP AV_CODEC_FLAG2_IGNORE_CROP + +#define CODEC_FLAG2_CHUNKS AV_CODEC_FLAG2_CHUNKS +#define CODEC_FLAG2_SHOW_ALL AV_CODEC_FLAG2_SHOW_ALL +#define CODEC_FLAG2_EXPORT_MVS AV_CODEC_FLAG2_EXPORT_MVS +#define CODEC_FLAG2_SKIP_MANUAL AV_CODEC_FLAG2_SKIP_MANUAL + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 AV_CODEC_CAP_DR1 +#define CODEC_CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED +#if FF_API_XVMC +/* Codec can export data for HW decoding. This flag indicates that + * the codec would call get_format() with list that might contain HW accelerated + * pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them + * including raw image format. + * The application can use the passed context to determine bitstream version, + * chroma format, resolution etc. + */ +#define CODEC_CAP_HWACCEL 0x0010 +#endif /* FF_API_XVMC */ +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define CODEC_CAP_DELAY AV_CODEC_CAP_DELAY +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define CODEC_CAP_HWACCEL_VDPAU AV_CODEC_CAP_HWACCEL_VDPAU +#endif +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carrying such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define CODEC_CAP_SUBFRAMES AV_CODEC_CAP_SUBFRAMES +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL AV_CODEC_CAP_EXPERIMENTAL +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF AV_CODEC_CAP_CHANNEL_CONF +#if FF_API_NEG_LINESIZES +/** + * @deprecated no codecs use this capability + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 +#endif +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS AV_CODEC_CAP_FRAME_THREADS +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS AV_CODEC_CAP_SLICE_THREADS +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE AV_CODEC_CAP_PARAM_CHANGE +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_AUTO_THREADS +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE +/** + * Codec is intra only. + */ +#define CODEC_CAP_INTRA_ONLY AV_CODEC_CAP_INTRA_ONLY +/** + * Codec is lossless. + */ +#define CODEC_CAP_LOSSLESS AV_CODEC_CAP_LOSSLESS + +/** + * HWAccel is experimental and is thus avoided in favor of non experimental + * codecs + */ +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 +#endif /* FF_API_WITHOUT_PREFIX */ + +#if FF_API_MB_TYPE +//The following defines may change, don't expect compatibility if you use them. +#define MB_TYPE_INTRA4x4 0x0001 +#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific +#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific +#define MB_TYPE_16x16 0x0008 +#define MB_TYPE_16x8 0x0010 +#define MB_TYPE_8x16 0x0020 +#define MB_TYPE_8x8 0x0040 +#define MB_TYPE_INTERLACED 0x0080 +#define MB_TYPE_DIRECT2 0x0100 //FIXME +#define MB_TYPE_ACPRED 0x0200 +#define MB_TYPE_GMC 0x0400 +#define MB_TYPE_SKIP 0x0800 +#define MB_TYPE_P0L0 0x1000 +#define MB_TYPE_P1L0 0x2000 +#define MB_TYPE_P0L1 0x4000 +#define MB_TYPE_P1L1 0x8000 +#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) +#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) +#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) +#define MB_TYPE_QUANT 0x00010000 +#define MB_TYPE_CBP 0x00020000 +// Note bits 24-31 are reserved for codec specific use (H.264 ref0, MPEG-1 0mv, ...) +#endif /** * Pan Scan area. * This specifies the area which should be displayed. * Note there may be multiple such areas for one frame. */ -typedef struct AVPanScan { +typedef struct AVPanScan{ /** * id * - encoding: Set by user. @@ -1089,7 +1344,7 @@ typedef struct AVPanScan { * - decoding: Set by libavcodec. */ int16_t position[3][2]; -} AVPanScan; +}AVPanScan; /** * This structure describes the bitrate properties of an encoded bitstream. It @@ -1129,6 +1384,13 @@ typedef struct AVCPBProperties { uint64_t vbv_delay; } AVCPBProperties; +#if FF_API_QSCALE_TYPE +#define FF_QSCALE_TYPE_MPEG1 0 +#define FF_QSCALE_TYPE_MPEG2 1 +#define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 +#endif + /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -1256,7 +1518,7 @@ enum AVPacketSideDataType { * u8 reason for end skip (0=padding silence, 1=convergence) * @endcode */ - AV_PKT_DATA_SKIP_SAMPLES, + AV_PKT_DATA_SKIP_SAMPLES=70, /** * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that @@ -1345,20 +1607,7 @@ enum AVPacketSideDataType { AV_PKT_DATA_A53_CC, /** - * This side data is encryption initialization data. - * The format is not part of ABI, use av_encryption_init_info_* methods to - * access. - */ - AV_PKT_DATA_ENCRYPTION_INIT_INFO, - - /** - * This side data contains encryption info for how to decrypt the packet. - * The format is not part of ABI, use av_encryption_info_* methods to access. - */ - AV_PKT_DATA_ENCRYPTION_INFO, - - /** - * The number of side data types. + * The number of side data elements (in fact a bit more than it). * This is not part of the public API/ABI in the sense that it may * change when new side data types are added. * This must stay the last enum value. @@ -1474,12 +1723,6 @@ typedef struct AVPacket { * outside the packet may be followed. */ #define AV_PKT_FLAG_TRUSTED 0x0008 -/** - * Flag is used to indicate packets that contain frames that can - * be discarded by the decoder. I.e. Non-reference frames. - */ -#define AV_PKT_FLAG_DISPOSABLE 0x0010 - enum AVSideDataParamChangeFlags { AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, @@ -1525,6 +1768,13 @@ typedef struct AVCodecContext { enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ const struct AVCodec *codec; +#if FF_API_CODEC_NAME + /** + * @deprecated this field is not used for anything in libavcodec + */ + attribute_deprecated + char codec_name[32]; +#endif enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ /** @@ -1542,6 +1792,14 @@ typedef struct AVCodecContext { */ unsigned int codec_tag; +#if FF_API_STREAM_CODEC_TAG + /** + * @deprecated this field is unused + */ + attribute_deprecated + unsigned int stream_codec_tag; +#endif + void *priv_data; /** @@ -1704,6 +1962,10 @@ typedef struct AVCodecContext { */ int coded_width, coded_height; +#if FF_API_ASPECT_EXTENDED +#define FF_ASPECT_EXTENDED 15 +#endif + /** * the number of pictures in a group of pictures, or 0 for intra_only * - encoding: Set by user. @@ -1726,6 +1988,14 @@ typedef struct AVCodecContext { */ enum AVPixelFormat pix_fmt; +#if FF_API_MOTION_EST + /** + * This option does nothing + * @deprecated use codec private options instead + */ + attribute_deprecated int me_method; +#endif + /** * If non NULL, 'draw_horiz_band' is called by the libavcodec * decoder to draw a horizontal band. It improves cache usage. Not @@ -1785,6 +2055,12 @@ typedef struct AVCodecContext { */ float b_quant_factor; +#if FF_API_RC_STRATEGY + /** @deprecated use codec private option instead */ + attribute_deprecated int rc_strategy; +#define FF_RC_STRATEGY_XVID 1 +#endif + #if FF_API_PRIVATE_OPT /** @deprecated use encoder private options instead */ attribute_deprecated @@ -1978,6 +2254,26 @@ typedef struct AVCodecContext { */ int me_subpel_quality; +#if FF_API_AFD + /** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + * @deprecated Deprecated in favor of AVSideData + */ + attribute_deprecated int dtg_active_format; +#define FF_DTG_AFD_SAME 8 +#define FF_DTG_AFD_4_3 9 +#define FF_DTG_AFD_16_9 10 +#define FF_DTG_AFD_14_9 11 +#define FF_DTG_AFD_4_3_SP_14_9 13 +#define FF_DTG_AFD_16_9_SP_14_9 14 +#define FF_DTG_AFD_SP_4_3 15 +#endif /* FF_API_AFD */ + /** * maximum motion estimation search range in subpel units * If 0 then no limit. @@ -1987,6 +2283,19 @@ typedef struct AVCodecContext { */ int me_range; +#if FF_API_QUANT_BIAS + /** + * @deprecated use encoder private option instead + */ + attribute_deprecated int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * @deprecated use encoder private option instead + */ + attribute_deprecated int inter_quant_bias; +#endif + /** * slice flags * - encoding: unused @@ -1997,6 +2306,16 @@ typedef struct AVCodecContext { #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics) #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) +#if FF_API_XVMC + /** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + * @deprecated XvMC doesn't need it anymore. + */ + attribute_deprecated int xvmc_acceleration; +#endif /* FF_API_XVMC */ + /** * macroblock decision mode * - encoding: Set by user. @@ -2031,6 +2350,20 @@ typedef struct AVCodecContext { int noise_reduction; #endif +#if FF_API_MPV_OPT + /** + * @deprecated this field is unused + */ + attribute_deprecated + int me_threshold; + + /** + * @deprecated this field is unused + */ + attribute_deprecated + int mb_threshold; +#endif + /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. @@ -2052,6 +2385,14 @@ typedef struct AVCodecContext { */ int skip_bottom; +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float border_masking; +#endif + /** * minimum MB Lagrange multiplier * - encoding: Set by user. @@ -2106,6 +2447,15 @@ typedef struct AVCodecContext { int chromaoffset; #endif +#if FF_API_UNUSED_MEMBERS + /** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated int scenechange_factor; +#endif + /** * Note: Value depends upon the compare function used for fullpel ME. * - encoding: Set by user. @@ -2368,6 +2718,19 @@ typedef struct AVCodecContext { */ int max_qdiff; +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float rc_qsquish; + + attribute_deprecated + float rc_qmod_amp; + attribute_deprecated + int rc_qmod_freq; +#endif + /** * decoder bitstream buffer size * - encoding: Set by user. @@ -2383,6 +2746,14 @@ typedef struct AVCodecContext { int rc_override_count; RcOverride *rc_override; +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + const char *rc_eq; +#endif + /** * maximum bitrate * - encoding: Set by user. @@ -2397,6 +2768,17 @@ typedef struct AVCodecContext { */ int64_t rc_min_rate; +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float rc_buffer_aggressivity; + + attribute_deprecated + float rc_initial_cplx; +#endif + /** * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow. * - encoding: Set by user. @@ -2423,6 +2805,9 @@ typedef struct AVCodecContext { #define FF_CODER_TYPE_AC 1 #define FF_CODER_TYPE_RAW 2 #define FF_CODER_TYPE_RLE 3 +#if FF_API_UNUSED_MEMBERS +#define FF_CODER_TYPE_DEFLATE 4 +#endif /* FF_API_UNUSED_MEMBERS */ /** * @deprecated use encoder private options instead */ @@ -2436,6 +2821,20 @@ typedef struct AVCodecContext { int context_model; #endif +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int lmin; + + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int lmax; +#endif + #if FF_API_PRIVATE_OPT /** @deprecated use encoder private options instead */ attribute_deprecated @@ -2546,10 +2945,16 @@ typedef struct AVCodecContext { */ int workaround_bugs; #define FF_BUG_AUTODETECT 1 ///< autodetection +#if FF_API_OLD_MSMPEG4 +#define FF_BUG_OLD_MSMPEG4 2 +#endif #define FF_BUG_XVID_ILACE 4 #define FF_BUG_UMP4 8 #define FF_BUG_NO_PADDING 16 #define FF_BUG_AMV 32 +#if FF_API_AC_VLC +#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. +#endif #define FF_BUG_QPEL_CHROMA 64 #define FF_BUG_STD_QPEL 128 #define FF_BUG_QPEL_CHROMA2 256 @@ -2610,6 +3015,9 @@ typedef struct AVCodecContext { #define FF_DEBUG_DCT_COEFF 0x00000040 #define FF_DEBUG_SKIP 0x00000080 #define FF_DEBUG_STARTCODE 0x00000100 +#if FF_API_UNUSED_MEMBERS +#define FF_DEBUG_PTS 0x00000200 +#endif /* FF_API_UNUSED_MEMBERS */ #define FF_DEBUG_ER 0x00000400 #define FF_DEBUG_MMCO 0x00000800 #define FF_DEBUG_BUGS 0x00001000 @@ -2671,7 +3079,7 @@ typedef struct AVCodecContext { * - encoding: unused. * - decoding: Set by libavcodec */ - const struct AVHWAccel *hwaccel; + struct AVHWAccel *hwaccel; /** * Hardware accelerator context. @@ -2717,12 +3125,27 @@ typedef struct AVCodecContext { #define FF_IDCT_SIMPLEMMX 3 #define FF_IDCT_ARM 7 #define FF_IDCT_ALTIVEC 8 +#if FF_API_ARCH_SH4 +#define FF_IDCT_SH4 9 +#endif #define FF_IDCT_SIMPLEARM 10 +#if FF_API_UNUSED_MEMBERS +#define FF_IDCT_IPP 13 +#endif /* FF_API_UNUSED_MEMBERS */ #define FF_IDCT_XVID 14 +#if FF_API_IDCT_XVIDMMX +#define FF_IDCT_XVIDMMX 14 +#endif /* FF_API_IDCT_XVIDMMX */ #define FF_IDCT_SIMPLEARMV5TE 16 #define FF_IDCT_SIMPLEARMV6 17 +#if FF_API_ARCH_SPARC +#define FF_IDCT_SIMPLEVIS 18 +#endif #define FF_IDCT_FAAN 20 #define FF_IDCT_SIMPLENEON 22 +#if FF_API_ARCH_ALPHA +#define FF_IDCT_SIMPLEALPHA 23 +#endif #define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */ #define FF_IDCT_SIMPLEAUTO 128 @@ -2933,18 +3356,6 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT 4 -#define FF_PROFILE_AV1_MAIN 0 -#define FF_PROFILE_AV1_HIGH 1 -#define FF_PROFILE_AV1_PROFESSIONAL 2 - -#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0 -#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 -#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 -#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3 -#define FF_PROFILE_MJPEG_JPEG_LS 0xf7 - -#define FF_PROFILE_SBC_MSBC 1 - /** * level * - encoding: Set by user. @@ -2985,6 +3396,15 @@ typedef struct AVCodecContext { uint8_t *subtitle_header; int subtitle_header_size; +#if FF_API_ERROR_RATE + /** + * @deprecated use the 'error_rate' private AVOption of the mpegvideo + * encoders + */ + attribute_deprecated + int error_rate; +#endif + #if FF_API_VBV_DELAY /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). @@ -3096,7 +3516,6 @@ typedef struct AVCodecContext { #define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) #define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself #define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv -#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8 /** * Skip processing alpha if supported by codec. @@ -3283,57 +3702,24 @@ typedef struct AVCodecContext { * (with the display dimensions being determined by the crop_* fields). */ int apply_cropping; - - /* - * Video decoding only. Sets the number of extra hardware frames which - * the decoder will allocate for use by the caller. This must be set - * before avcodec_open2() is called. - * - * Some hardware decoders require all frames that they will use for - * output to be defined in advance before decoding starts. For such - * decoders, the hardware frame pool must therefore be of a fixed size. - * The extra frames set here are on top of any number that the decoder - * needs internally in order to operate normally (for example, frames - * used as reference pictures). - */ - int extra_hw_frames; } AVCodecContext; -#if FF_API_CODEC_GET_SET -/** - * Accessors for some AVCodecContext fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -attribute_deprecated void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); -attribute_deprecated const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -attribute_deprecated void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); -attribute_deprecated unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); -#if FF_API_LOWRES -attribute_deprecated int av_codec_get_lowres(const AVCodecContext *avctx); -attribute_deprecated void av_codec_set_lowres(AVCodecContext *avctx, int val); -#endif -attribute_deprecated int av_codec_get_seek_preroll(const AVCodecContext *avctx); -attribute_deprecated void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); -attribute_deprecated uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -attribute_deprecated void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); -#endif /** * AVProfile. @@ -3343,61 +3729,6 @@ typedef struct AVProfile { const char *name; ///< short name for the profile } AVProfile; -enum { - /** - * The codec supports this format via the hw_device_ctx interface. - * - * When selecting this format, AVCodecContext.hw_device_ctx should - * have been set to a device of the specified type before calling - * avcodec_open2(). - */ - AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01, - /** - * The codec supports this format via the hw_frames_ctx interface. - * - * When selecting this format for a decoder, - * AVCodecContext.hw_frames_ctx should be set to a suitable frames - * context inside the get_format() callback. The frames context - * must have been created on a device of the specified type. - */ - AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02, - /** - * The codec supports this format by some internal method. - * - * This format can be selected without any additional configuration - - * no device or frames context is required. - */ - AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04, - /** - * The codec supports this format by some ad-hoc method. - * - * Additional settings and/or function calls are required. See the - * codec-specific documentation for details. (Methods requiring - * this sort of configuration are deprecated and others should be - * used in preference.) - */ - AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08, -}; - -typedef struct AVCodecHWConfig { - /** - * A hardware pixel format which the codec can use. - */ - enum AVPixelFormat pix_fmt; - /** - * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible - * setup methods which can be used with this configuration. - */ - int methods; - /** - * The device type associated with the configuration. - * - * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and - * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused. - */ - enum AVHWDeviceType device_type; -} AVCodecHWConfig; - typedef struct AVCodecDefault AVCodecDefault; struct AVSubtitle; @@ -3434,18 +3765,6 @@ typedef struct AVCodec { const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} - /** - * Group name of the codec implementation. - * This is a short symbolic name of the wrapper backing this codec. A - * wrapper uses some kind of external implementation for the codec, such - * as an external library, or a codec implementation provided by the OS or - * the hardware. - * If this field is NULL, this is a builtin, libavcodec native codec. - * If non-NULL, this will be the suffix in AVCodec.name in most cases - * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>"). - */ - const char *wrapper_name; - /***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavcodec and can be changed and @@ -3482,9 +3801,6 @@ typedef struct AVCodec { /** * Initialize codec static data, called from avcodec_register(). - * - * This is not intended for time consuming operations as it is - * run for every codec regardless of that codec being used. */ void (*init_static_data)(struct AVCodec *codec); @@ -3538,39 +3854,14 @@ typedef struct AVCodec { * packets before decoding. */ const char *bsfs; - - /** - * Array of pointers to hardware configurations supported by the codec, - * or NULL if no hardware supported. The array is terminated by a NULL - * pointer. - * - * The user can only access this field via avcodec_get_hw_config(). - */ - const struct AVCodecHWConfigInternal **hw_configs; } AVCodec; -#if FF_API_CODEC_GET_SET -attribute_deprecated int av_codec_get_max_lowres(const AVCodec *codec); -#endif struct MpegEncContext; /** - * Retrieve supported hardware configurations for a codec. - * - * Values of index from zero to some maximum return the indexed configuration - * descriptor; all other values return NULL. If the codec does not support - * any hardware configurations then it will always return NULL. - */ -const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index); - -/** * @defgroup lavc_hwaccel AVHWAccel - * - * @note Nothing in this structure should be accessed by the user. At some - * point in future it will not be externally visible at all. - * * @{ */ typedef struct AVHWAccel { @@ -3615,6 +3906,7 @@ typedef struct AVHWAccel { * New public fields should be added right above. ***************************************************************** */ + struct AVHWAccel *next; /** * Allocate a custom buffer @@ -3638,20 +3930,6 @@ typedef struct AVHWAccel { int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); /** - * Callback for parameter data (SPS/PPS/VPS etc). - * - * Useful for hardware decoders which keep persistent state about the - * video parameters, and need to receive any changes to update that state. - * - * @param avctx the codec context - * @param type the nal unit type - * @param buf the nal unit data buffer - * @param buf_size the size of the nal unit in bytes - * @return zero if successful, a negative value otherwise - */ - int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size); - - /** * Callback for each slice. * * Meaningful slice information (codec specific) is guaranteed to @@ -3723,16 +4001,6 @@ typedef struct AVHWAccel { * Internal hwaccel capabilities. */ int caps_internal; - - /** - * Fill the given hw_frames context with current codec parameters. Called - * from get_format. Refer to avcodec_get_hw_frames_parameters() for - * details. - * - * This CAN be called before AVHWAccel.init is called, and you must assume - * that avctx->hwaccel_priv_data is invalid. - */ - int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); } AVHWAccel; /** @@ -4025,25 +4293,11 @@ typedef struct AVCodecParameters { } AVCodecParameters; /** - * Iterate over all registered codecs. - * - * @param opaque a pointer where libavcodec will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered codec or NULL when the iteration is - * finished - */ -const AVCodec *av_codec_iterate(void **opaque); - -#if FF_API_NEXT -/** * If c is NULL, returns the first registered codec, * if c is non-NULL, returns the next registered codec after c, * or NULL if c is the last one. */ -attribute_deprecated AVCodec *av_codec_next(const AVCodec *c); -#endif /** * Return the LIBAVCODEC_VERSION_INT constant. @@ -4060,7 +4314,6 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); -#if FF_API_NEXT /** * Register the codec codec and initialize libavcodec. * @@ -4069,7 +4322,6 @@ const char *avcodec_license(void); * * @see avcodec_register_all() */ -attribute_deprecated void avcodec_register(AVCodec *codec); /** @@ -4082,9 +4334,7 @@ void avcodec_register(AVCodec *codec); * @see av_register_codec_parser * @see av_register_bitstream_filter */ -attribute_deprecated void avcodec_register_all(void); -#endif /** * Allocate an AVCodecContext and set its fields to default values. The @@ -4365,7 +4615,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. * - * @deprecated Use av_packet_ref or av_packet_make_refcounted + * @deprecated Use av_packet_ref */ attribute_deprecated int av_dup_packet(AVPacket *pkt); @@ -4537,33 +4787,6 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src); int av_packet_copy_props(AVPacket *dst, const AVPacket *src); /** - * Ensure the data described by a given packet is reference counted. - * - * @note This function does not ensure that the reference will be writable. - * Use av_packet_make_writable instead for that purpose. - * - * @see av_packet_ref - * @see av_packet_make_writable - * - * @param pkt packet whose data should be made reference counted. - * - * @return 0 on success, a negative AVERROR on error. On failure, the - * packet is unchanged. - */ -int av_packet_make_refcounted(AVPacket *pkt); - -/** - * Create a writable reference for the data described by a given packet, - * avoiding data copy if possible. - * - * @param pkt Packet whose data should be made writable. - * - * @return 0 on success, a negative AVERROR on failure. On failure, the - * packet is unchanged. - */ -int av_packet_make_writable(AVPacket *pkt); - -/** * Convert valid timing fields (timestamps / durations) in a packet from one * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be * ignored. @@ -4608,6 +4831,21 @@ AVCodec *avcodec_find_decoder_by_name(const char *name); */ int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); +#if FF_API_EMU_EDGE +/** + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. + * + * @return Required padding in pixels. + * + * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer + * needed + */ +attribute_deprecated +unsigned avcodec_get_edge_width(void); +#endif + /** * Modify width and height values so that they will result in a memory * buffer that is acceptable for the codec if you do not use any horizontal @@ -4913,109 +5151,6 @@ int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame); */ int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); -/** - * Create and return a AVHWFramesContext with values adequate for hardware - * decoding. This is meant to get called from the get_format callback, and is - * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx. - * This API is for decoding with certain hardware acceleration modes/APIs only. - * - * The returned AVHWFramesContext is not initialized. The caller must do this - * with av_hwframe_ctx_init(). - * - * Calling this function is not a requirement, but makes it simpler to avoid - * codec or hardware API specific details when manually allocating frames. - * - * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx, - * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes - * it unnecessary to call this function or having to care about - * AVHWFramesContext initialization at all. - * - * There are a number of requirements for calling this function: - * - * - It must be called from get_format with the same avctx parameter that was - * passed to get_format. Calling it outside of get_format is not allowed, and - * can trigger undefined behavior. - * - The function is not always supported (see description of return values). - * Even if this function returns successfully, hwaccel initialization could - * fail later. (The degree to which implementations check whether the stream - * is actually supported varies. Some do this check only after the user's - * get_format callback returns.) - * - The hw_pix_fmt must be one of the choices suggested by get_format. If the - * user decides to use a AVHWFramesContext prepared with this API function, - * the user must return the same hw_pix_fmt from get_format. - * - The device_ref passed to this function must support the given hw_pix_fmt. - * - After calling this API function, it is the user's responsibility to - * initialize the AVHWFramesContext (returned by the out_frames_ref parameter), - * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done - * before returning from get_format (this is implied by the normal - * AVCodecContext.hw_frames_ctx API rules). - * - The AVHWFramesContext parameters may change every time time get_format is - * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So - * you are inherently required to go through this process again on every - * get_format call. - * - It is perfectly possible to call this function without actually using - * the resulting AVHWFramesContext. One use-case might be trying to reuse a - * previously initialized AVHWFramesContext, and calling this API function - * only to test whether the required frame parameters have changed. - * - Fields that use dynamically allocated values of any kind must not be set - * by the user unless setting them is explicitly allowed by the documentation. - * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque, - * the new free callback must call the potentially set previous free callback. - * This API call may set any dynamically allocated fields, including the free - * callback. - * - * The function will set at least the following fields on AVHWFramesContext - * (potentially more, depending on hwaccel API): - * - * - All fields set by av_hwframe_ctx_alloc(). - * - Set the format field to hw_pix_fmt. - * - Set the sw_format field to the most suited and most versatile format. (An - * implication is that this will prefer generic formats over opaque formats - * with arbitrary restrictions, if possible.) - * - Set the width/height fields to the coded frame size, rounded up to the - * API-specific minimum alignment. - * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size - * field to the number of maximum reference surfaces possible with the codec, - * plus 1 surface for the user to work (meaning the user can safely reference - * at most 1 decoded surface at a time), plus additional buffering introduced - * by frame threading. If the hwaccel does not require pre-allocation, the - * field is left to 0, and the decoder will allocate new surfaces on demand - * during decoding. - * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying - * hardware API. - * - * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but - * with basic frame parameters set. - * - * The function is stateless, and does not change the AVCodecContext or the - * device_ref AVHWDeviceContext. - * - * @param avctx The context which is currently calling get_format, and which - * implicitly contains all state needed for filling the returned - * AVHWFramesContext properly. - * @param device_ref A reference to the AVHWDeviceContext describing the device - * which will be used by the hardware decoder. - * @param hw_pix_fmt The hwaccel format you are going to return from get_format. - * @param out_frames_ref On success, set to a reference to an _uninitialized_ - * AVHWFramesContext, created from the given device_ref. - * Fields will be set to values required for decoding. - * Not changed if an error is returned. - * @return zero on success, a negative value on error. The following error codes - * have special semantics: - * AVERROR(ENOENT): the decoder does not support this functionality. Setup - * is always manual, or it is a decoder which does not - * support setting AVCodecContext.hw_frames_ctx at all, - * or it is a software format. - * AVERROR(EINVAL): it is known that hardware decoding is not supported for - * this configuration, or the device_ref is not supported - * for the hwaccel referenced by hw_pix_fmt. - */ -int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, - AVBufferRef *device_ref, - enum AVPixelFormat hw_pix_fmt, - AVBufferRef **out_frames_ref); - - /** * @defgroup lavc_parsing Frame parsing @@ -5211,21 +5346,8 @@ typedef struct AVCodecParser { struct AVCodecParser *next; } AVCodecParser; -/** - * Iterate over all registered codec parsers. - * - * @param opaque a pointer where libavcodec will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered codec parser or NULL when the iteration is - * finished - */ -const AVCodecParser *av_parser_iterate(void **opaque); - -attribute_deprecated AVCodecParser *av_parser_next(const AVCodecParser *c); -attribute_deprecated void av_register_codec_parser(AVCodecParser *parser); AVCodecParserContext *av_parser_init(int codec_id); @@ -5394,6 +5516,103 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ +#if FF_API_AVCODEC_RESAMPLE +/** + * @defgroup lavc_resample Audio resampling + * @ingroup libavc + * @deprecated use libswresample instead + * + * @{ + */ +struct ReSampleContext; +struct AVResampleContext; + +typedef struct ReSampleContext ReSampleContext; + +/** + * Initialize audio resampling context. + * + * @param output_channels number of output channels + * @param input_channels number of input channels + * @param output_rate output sample rate + * @param input_rate input sample rate + * @param sample_fmt_out requested output sample format + * @param sample_fmt_in input sample format + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear if 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + * @return allocated ReSampleContext, NULL if error occurred + */ +attribute_deprecated +ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, + int output_rate, int input_rate, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, + int filter_length, int log2_phase_count, + int linear, double cutoff); + +attribute_deprecated +int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ +attribute_deprecated +void audio_resample_close(ReSampleContext *s); + + +/** + * Initialize an audio resampler. + * Note, if either rate is not an integer then simply scale both rates up so they are. + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear If 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + */ +attribute_deprecated +struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); + +/** + * Resample an array of samples using a previously configured context. + * @param src an array of unconsumed samples + * @param consumed the number of samples of src which have been consumed are returned here + * @param src_size the number of unconsumed samples available + * @param dst_size the amount of space in samples available in dst + * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. + * @return the number of samples written in dst or -1 if an error occurred + */ +attribute_deprecated +int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); + + +/** + * Compensate samplerate/timestamp drift. The compensation is done by changing + * the resampler parameters, so no audible clicks or similar distortions occur + * @param compensation_distance distance in output samples over which the compensation should be performed + * @param sample_delta number of output samples which should be output less + * + * example: av_resample_compensate(c, 10, 500) + * here instead of 510 samples only 500 samples would be output + * + * note, due to rounding the actual compensation might be slightly different, + * especially if the compensation_distance is large and the in_rate used during init is small + */ +attribute_deprecated +void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); +attribute_deprecated +void av_resample_close(struct AVResampleContext *c); + +/** + * @} + */ +#endif + #if FF_API_AVPICTURE /** * @addtogroup lavc_picture @@ -5534,6 +5753,14 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en * @} */ +#if FF_API_SET_DIMENSIONS +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated +void avcodec_set_dimensions(AVCodecContext *s, int width, int height); +#endif + #if FF_API_TAG_STRING /** * Put a string representing the codec tag codec_tag in buf. @@ -5770,42 +5997,84 @@ typedef struct AVBitStreamFilter { #if FF_API_OLD_BSF /** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use the new bitstream filtering API (using AVBSFContext). + * Register a bitstream filter. + * + * The filter will be accessible to the application code through + * av_bitstream_filter_next() or can be directly initialized with + * av_bitstream_filter_init(). + * + * @see avcodec_register_all() */ attribute_deprecated void av_register_bitstream_filter(AVBitStreamFilter *bsf); + /** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() - * from the new bitstream filtering API (using AVBSFContext). + * Create and initialize a bitstream filter context given a bitstream + * filter name. + * + * The returned context must be freed with av_bitstream_filter_close(). + * + * @param name the name of the bitstream filter + * @return a bitstream filter context if a matching filter was found + * and successfully initialized, NULL otherwise */ attribute_deprecated AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); + /** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the - * new bitstream filtering API (using AVBSFContext). + * Filter bitstream. + * + * This function filters the buffer buf with size buf_size, and places the + * filtered buffer in the buffer pointed to by poutbuf. + * + * The output buffer must be freed by the caller. + * + * @param bsfc bitstream filter context created by av_bitstream_filter_init() + * @param avctx AVCodecContext accessed by the filter, may be NULL. + * If specified, this must point to the encoder context of the + * output stream the packet is sent to. + * @param args arguments which specify the filter configuration, may be NULL + * @param poutbuf pointer which is updated to point to the filtered buffer + * @param poutbuf_size pointer which is updated to the filtered buffer size in bytes + * @param buf buffer containing the data to filter + * @param buf_size size in bytes of buf + * @param keyframe set to non-zero if the buffer to filter corresponds to a key-frame packet data + * @return >= 0 in case of success, or a negative error code in case of failure + * + * If the return value is positive, an output buffer is allocated and + * is available in *poutbuf, and is distinct from the input buffer. + * + * If the return value is 0, the output buffer is not allocated and + * should be considered identical to the input buffer, or in case + * *poutbuf was set it points to the input buffer (not necessarily to + * its starting address). A special case is if *poutbuf was set to NULL and + * *poutbuf_size was set to 0, which indicates the packet should be dropped. */ attribute_deprecated int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe); + /** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using - * AVBSFContext). + * Release bitstream filter context. + * + * @param bsf the bitstream filter context created with + * av_bitstream_filter_init(), can be NULL */ attribute_deprecated void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); + /** - * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) - * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using - * AVBSFContext). + * If f is NULL, return the first registered bitstream filter, + * if f is non-NULL, return the next registered bitstream filter + * after f, or NULL if f is the last one. + * + * This function can be used to iterate over all registered bitstream + * filters. */ attribute_deprecated -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); +AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); #endif /** @@ -5823,11 +6092,7 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name); * @return the next registered bitstream filter or NULL when the iteration is * finished */ -const AVBitStreamFilter *av_bsf_iterate(void **opaque); -#if FF_API_NEXT -attribute_deprecated const AVBitStreamFilter *av_bsf_next(void **opaque); -#endif /** * Allocate a context for a given bitstream filter. The caller must fill in the @@ -6017,32 +6282,51 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); */ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); -#if FF_API_USER_VISIBLE_AVHWACCEL +#if FF_API_MISSING_SAMPLE /** - * Register the hardware accelerator hwaccel. - * - * @deprecated This function doesn't do anything. + * Log a generic warning message about a missing feature. This function is + * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] feature string containing the name of the missing feature + * @param[in] want_sample indicates if samples are wanted which exhibit this feature. + * If want_sample is non-zero, additional verbiage will be added to the log + * message which tells the user how to report samples to the development + * mailing list. + * @deprecated Use avpriv_report_missing_feature() instead. */ attribute_deprecated +void av_log_missing_feature(void *avc, const char *feature, int want_sample); + +/** + * Log a generic warning message asking for a sample. This function is + * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] msg string containing an optional message, or NULL if no message + * @deprecated Use avpriv_request_sample() instead. + */ +attribute_deprecated +void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); +#endif /* FF_API_MISSING_SAMPLE */ + +/** + * Register the hardware accelerator hwaccel. + */ void av_register_hwaccel(AVHWAccel *hwaccel); /** * If hwaccel is NULL, returns the first registered hardware accelerator, * if hwaccel is non-NULL, returns the next registered hardware accelerator * after hwaccel, or NULL if hwaccel is the last one. - * - * @deprecated AVHWaccel structures contain no user-serviceable parts, so - * this function should not be used. */ -attribute_deprecated AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); -#endif -#if FF_API_LOCKMGR + /** * Lock operation used by lockmgr - * - * @deprecated Deprecated together with av_lockmgr_register(). */ enum AVLockOp { AV_LOCK_CREATE, ///< Create a mutex @@ -6073,13 +6357,8 @@ enum AVLockOp { * mechanism (i.e. do not use a single static object to * implement your lock manager). If cb is set to NULL the * lockmgr will be unregistered. - * - * @deprecated This function does nothing, and always returns 0. Be sure to - * build with thread support to get basic thread safety. */ -attribute_deprecated int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); -#endif /** * Get the type of the given codec. diff --git a/media/ffvpx/libavcodec/avcodec.symbols b/media/ffvpx/libavcodec/avcodec.symbols index d34c6ed7e..cf507f722 100644 --- a/media/ffvpx/libavcodec/avcodec.symbols +++ b/media/ffvpx/libavcodec/avcodec.symbols @@ -1,3 +1,7 @@ +av_bitstream_filter_close +av_bitstream_filter_filter +av_bitstream_filter_init +av_bitstream_filter_next av_codec_ffversion av_codec_get_chroma_intra_matrix av_codec_get_codec_descriptor @@ -30,6 +34,8 @@ av_grow_packet av_hwaccel_next av_init_packet av_lockmgr_register +av_log_ask_for_sample +av_log_missing_feature av_new_packet av_packet_copy_props av_packet_free_side_data @@ -51,11 +57,17 @@ av_parser_close av_parser_init av_parser_next av_parser_parse2 -av_rdft_calc -av_rdft_end -av_rdft_init +av_picture_copy +av_picture_crop +av_picture_pad +av_qsv_alloc_context +av_register_bitstream_filter av_register_codec_parser av_register_hwaccel +av_resample +av_resample_close +av_resample_compensate +av_resample_init av_shrink_packet av_vorbis_parse_frame av_vorbis_parse_frame_flags @@ -82,23 +94,36 @@ avcodec_descriptor_get_by_name avcodec_descriptor_next avcodec_enum_to_chroma_pos avcodec_fill_audio_frame +avcodec_find_best_pix_fmt2 +avcodec_find_best_pix_fmt_of_2 +avcodec_find_best_pix_fmt_of_list avcodec_find_decoder avcodec_find_decoder_by_name avcodec_find_encoder avcodec_find_encoder_by_name avcodec_flush_buffers avcodec_free_context +avcodec_get_chroma_sub_sample avcodec_get_class avcodec_get_context_defaults3 +avcodec_get_edge_width avcodec_get_frame_class avcodec_get_name +avcodec_get_pix_fmt_loss avcodec_get_subtitle_rect_class avcodec_get_type avcodec_is_open avcodec_license avcodec_open2 +avcodec_pix_fmt_to_codec_tag avcodec_register avcodec_register_all +avcodec_set_dimensions avcodec_string avcodec_version +avpicture_alloc +avpicture_fill +avpicture_free +avpicture_get_size +avpicture_layout avsubtitle_free diff --git a/media/ffvpx/libavcodec/avpacket.c b/media/ffvpx/libavcodec/avpacket.c index 99a0c1383..d1f4ea9eb 100644 --- a/media/ffvpx/libavcodec/avpacket.c +++ b/media/ffvpx/libavcodec/avpacket.c @@ -479,6 +479,34 @@ int av_packet_split_side_data(AVPacket *pkt){ } #endif +#if FF_API_MERGE_SD +int ff_packet_split_and_drop_side_data(AVPacket *pkt){ + if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){ + int i; + unsigned int size; + uint8_t *p; + + p = pkt->data + pkt->size - 8 - 5; + for (i=1; ; i++){ + size = AV_RB32(p); + if (size>INT_MAX - 5 || p - pkt->data < size) + return 0; + if (p[4]&128) + break; + if (p - pkt->data < size + 5) + return 0; + p-= size+5; + if (i > AV_PKT_DATA_NB) + return 0; + } + pkt->size = p - pkt->data - size; + av_assert0(pkt->size >= 0); + return 1; + } + return 0; +} +#endif + uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size) { AVDictionaryEntry *t = NULL; @@ -571,8 +599,6 @@ FF_ENABLE_DEPRECATION_WARNINGS dst->flags = src->flags; dst->stream_index = src->stream_index; - dst->side_data = NULL; - dst->side_data_elems = 0; for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; int size = src->side_data[i].size; @@ -652,45 +678,6 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src) src->size = 0; } -int av_packet_make_refcounted(AVPacket *pkt) -{ - int ret; - - if (pkt->buf) - return 0; - - ret = packet_alloc(&pkt->buf, pkt->size); - if (ret < 0) - return ret; - if (pkt->size) - memcpy(pkt->buf->data, pkt->data, pkt->size); - - pkt->data = pkt->buf->data; - - return 0; -} - -int av_packet_make_writable(AVPacket *pkt) -{ - AVBufferRef *buf = NULL; - int ret; - - if (pkt->buf && av_buffer_is_writable(pkt->buf)) - return 0; - - ret = packet_alloc(&buf, pkt->size); - if (ret < 0) - return ret; - if (pkt->size) - memcpy(buf->data, pkt->data, pkt->size); - - av_buffer_unref(&pkt->buf); - pkt->buf = buf; - pkt->data = buf->data; - - return 0; -} - void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb) { if (pkt->pts != AV_NOPTS_VALUE) diff --git a/media/ffvpx/libavcodec/bit_depth_template.c b/media/ffvpx/libavcodec/bit_depth_template.c index d44d47ea4..80184892f 100644 --- a/media/ffvpx/libavcodec/bit_depth_template.c +++ b/media/ffvpx/libavcodec/bit_depth_template.c @@ -29,7 +29,6 @@ # undef pixel2 # undef pixel4 # undef dctcoef -# undef idctin # undef INIT_CLIP # undef no_rnd_avg_pixel4 # undef rnd_avg_pixel4 @@ -54,16 +53,6 @@ # define pixel4 uint64_t # define dctcoef int32_t -#ifdef IN_IDCT_DEPTH -#if IN_IDCT_DEPTH == 32 -# define idctin int32_t -#else -# define idctin int16_t -#endif -#else -# define idctin int16_t -#endif - # define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg64 # define rnd_avg_pixel4 rnd_avg64 @@ -82,7 +71,6 @@ # define pixel2 uint16_t # define pixel4 uint32_t # define dctcoef int16_t -# define idctin int16_t # define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg32 @@ -99,10 +87,7 @@ # define CLIP(a) av_clip_uint8(a) #endif -#define FUNC3(a, b, c) a ## _ ## b ## c +#define FUNC3(a, b, c) a ## _ ## b ## c #define FUNC2(a, b, c) FUNC3(a, b, c) #define FUNC(a) FUNC2(a, BIT_DEPTH,) #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c) -#define FUNC4(a, b, c) a ## _int ## b ## _ ## c ## bit -#define FUNC5(a, b, c) FUNC4(a, b, c) -#define FUNC6(a) FUNC5(a, IN_IDCT_DEPTH, BIT_DEPTH) diff --git a/media/ffvpx/libavcodec/bitstream_filter.c b/media/ffvpx/libavcodec/bitstream_filter.c index ca11ed371..8599b90d4 100644 --- a/media/ffvpx/libavcodec/bitstream_filter.c +++ b/media/ffvpx/libavcodec/bitstream_filter.c @@ -28,15 +28,15 @@ #if FF_API_OLD_BSF FF_DISABLE_DEPRECATION_WARNINGS -const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f) +AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f) { const AVBitStreamFilter *filter = NULL; void *opaque = NULL; while (filter != f) - filter = av_bsf_iterate(&opaque); + filter = av_bsf_next(&opaque); - return av_bsf_iterate(&opaque); + return av_bsf_next(&opaque); } void av_register_bitstream_filter(AVBitStreamFilter *bsf) @@ -131,7 +131,7 @@ int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, return ret; } - pkt.data = (uint8_t *)buf; + pkt.data = buf; pkt.size = buf_size; ret = av_bsf_send_packet(priv->ctx, &pkt); diff --git a/media/ffvpx/libavcodec/bitstream_filters.c b/media/ffvpx/libavcodec/bitstream_filters.c index 18b698a85..ce34de640 100644 --- a/media/ffvpx/libavcodec/bitstream_filters.c +++ b/media/ffvpx/libavcodec/bitstream_filters.c @@ -28,34 +28,26 @@ extern const AVBitStreamFilter ff_aac_adtstoasc_bsf; extern const AVBitStreamFilter ff_chomp_bsf; extern const AVBitStreamFilter ff_dump_extradata_bsf; extern const AVBitStreamFilter ff_dca_core_bsf; -extern const AVBitStreamFilter ff_eac3_core_bsf; extern const AVBitStreamFilter ff_extract_extradata_bsf; -extern const AVBitStreamFilter ff_filter_units_bsf; -extern const AVBitStreamFilter ff_h264_metadata_bsf; extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf; -extern const AVBitStreamFilter ff_h264_redundant_pps_bsf; -extern const AVBitStreamFilter ff_hapqa_extract_bsf; -extern const AVBitStreamFilter ff_hevc_metadata_bsf; extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf; extern const AVBitStreamFilter ff_imx_dump_header_bsf; extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf; extern const AVBitStreamFilter ff_mjpega_dump_header_bsf; extern const AVBitStreamFilter ff_mp3_header_decompress_bsf; -extern const AVBitStreamFilter ff_mpeg2_metadata_bsf; extern const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf; extern const AVBitStreamFilter ff_mov2textsub_bsf; extern const AVBitStreamFilter ff_noise_bsf; extern const AVBitStreamFilter ff_null_bsf; extern const AVBitStreamFilter ff_remove_extradata_bsf; extern const AVBitStreamFilter ff_text2movsub_bsf; -extern const AVBitStreamFilter ff_trace_headers_bsf; extern const AVBitStreamFilter ff_vp9_raw_reorder_bsf; extern const AVBitStreamFilter ff_vp9_superframe_bsf; extern const AVBitStreamFilter ff_vp9_superframe_split_bsf; #include "libavcodec/bsf_list.c" -const AVBitStreamFilter *av_bsf_iterate(void **opaque) +const AVBitStreamFilter *av_bsf_next(void **opaque) { uintptr_t i = (uintptr_t)*opaque; const AVBitStreamFilter *f = bitstream_filters[i]; @@ -66,18 +58,12 @@ const AVBitStreamFilter *av_bsf_iterate(void **opaque) return f; } -#if FF_API_NEXT -const AVBitStreamFilter *av_bsf_next(void **opaque) { - return av_bsf_iterate(opaque); -} -#endif - const AVBitStreamFilter *av_bsf_get_by_name(const char *name) { - const AVBitStreamFilter *f = NULL; - void *i = 0; + int i; - while ((f = av_bsf_iterate(&i))) { + for (i = 0; bitstream_filters[i]; i++) { + const AVBitStreamFilter *f = bitstream_filters[i]; if (!strcmp(f->name, name)) return f; } @@ -87,20 +73,19 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name) const AVClass *ff_bsf_child_class_next(const AVClass *prev) { - const AVBitStreamFilter *f = NULL; - void *i = 0; + int i; /* find the filter that corresponds to prev */ - while (prev && (f = av_bsf_iterate(&i))) { - if (f->priv_class == prev) { + for (i = 0; prev && bitstream_filters[i]; i++) { + if (bitstream_filters[i]->priv_class == prev) { + i++; break; } } /* find next filter with priv options */ - while ((f = av_bsf_iterate(&i))) { - if (f->priv_class) - return f->priv_class; - } + for (; bitstream_filters[i]; i++) + if (bitstream_filters[i]->priv_class) + return bitstream_filters[i]->priv_class; return NULL; } diff --git a/media/ffvpx/libavcodec/blockdsp.h b/media/ffvpx/libavcodec/blockdsp.h index 26fc2ea13..6e27a02ba 100644 --- a/media/ffvpx/libavcodec/blockdsp.h +++ b/media/ffvpx/libavcodec/blockdsp.h @@ -33,8 +33,8 @@ typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, uint8_t value, ptrdiff_t line_size, int h); typedef struct BlockDSPContext { - void (*clear_block)(int16_t *block /* align 32 */); - void (*clear_blocks)(int16_t *blocks /* align 32 */); + void (*clear_block)(int16_t *block /* align 16 */); + void (*clear_blocks)(int16_t *blocks /* align 16 */); op_fill_func fill_block_tab[2]; } BlockDSPContext; diff --git a/media/ffvpx/libavcodec/bsf.c b/media/ffvpx/libavcodec/bsf.c index bd611ea16..38b423101 100644 --- a/media/ffvpx/libavcodec/bsf.c +++ b/media/ffvpx/libavcodec/bsf.c @@ -174,8 +174,6 @@ int av_bsf_init(AVBSFContext *ctx) int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { - int ret; - if (!pkt || (!pkt->data && !pkt->side_data_elems)) { ctx->internal->eof = 1; return 0; @@ -190,9 +188,6 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) ctx->internal->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); - ret = av_packet_make_refcounted(pkt); - if (ret < 0) - return ret; av_packet_move_ref(ctx->internal->buffer_pkt, pkt); return 0; diff --git a/media/ffvpx/libavcodec/bsf_list.c b/media/ffvpx/libavcodec/bsf_list.c index 92d9948b2..d31ece942 100644 --- a/media/ffvpx/libavcodec/bsf_list.c +++ b/media/ffvpx/libavcodec/bsf_list.c @@ -1,6 +1,3 @@ static const AVBitStreamFilter * const bitstream_filters[] = { &ff_null_bsf, -#if CONFIG_VP9_SUPERFRAME_SPLIT_BSF - &ff_vp9_superframe_split_bsf, -#endif NULL }; diff --git a/media/ffvpx/libavcodec/codec_desc.c b/media/ffvpx/libavcodec/codec_desc.c index 79552a910..6a13bbbf0 100644 --- a/media/ffvpx/libavcodec/codec_desc.c +++ b/media/ffvpx/libavcodec/codec_desc.c @@ -46,6 +46,15 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles), }, +#if FF_API_XVMC + { + .id = AV_CODEC_ID_MPEG2VIDEO_XVMC, + .type = AVMEDIA_TYPE_VIDEO, + .name = "mpegvideo_xvmc", + .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"), + .props = AV_CODEC_PROP_LOSSY, + }, +#endif /* FF_API_XVMC */ { .id = AV_CODEC_ID_H261, .type = AVMEDIA_TYPE_VIDEO, @@ -90,28 +99,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_LJPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ljpeg", - .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SP5X, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sp5x", - .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_JPEGLS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "jpegls", - .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_MPEG4, .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg4", @@ -183,6 +170,14 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_SVG, + .type = AVMEDIA_TYPE_VIDEO, + .name = "svg", + .long_name = NULL_IF_CONFIG_SMALL("Scalable Vector Graphics"), + .props = AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/svg+xml"), + }, + { .id = AV_CODEC_ID_SVQ1, .type = AVMEDIA_TYPE_VIDEO, .name = "svq1", @@ -422,6 +417,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_SNOW, + .type = AVMEDIA_TYPE_VIDEO, + .name = "snow", + .long_name = NULL_IF_CONFIG_SMALL("Snow"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_TSCC, .type = AVMEDIA_TYPE_VIDEO, .name = "tscc", @@ -457,50 +459,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_PNG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "png", - .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), - .props = AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/png"), - }, - { - .id = AV_CODEC_ID_PPM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ppm", - .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PBM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pbm", - .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PGM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pgm", - .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PGMYUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pgmyuv", - .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PAM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pam", - .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-portable-pixmap"), - }, - { .id = AV_CODEC_ID_FFVHUFF, .type = AVMEDIA_TYPE_VIDEO, .name = "ffvhuff", @@ -689,14 +647,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_TARGA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "targa", - .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-targa", "image/x-tga"), - }, - { .id = AV_CODEC_ID_DSICINVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "dsicinvideo", @@ -711,22 +661,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_TIFF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tiff", - .long_name = NULL_IF_CONFIG_SMALL("TIFF image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/tiff"), - }, - { - .id = AV_CODEC_ID_GIF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "gif", - .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"), - .props = AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/gif"), - }, - { .id = AV_CODEC_ID_DXA, .type = AVMEDIA_TYPE_VIDEO, .name = "dxa", @@ -749,13 +683,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_SGI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sgi", - .long_name = NULL_IF_CONFIG_SMALL("SGI image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_C93, .type = AVMEDIA_TYPE_VIDEO, .name = "c93", @@ -770,20 +697,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_PTX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ptx", - .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TXD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "txd", - .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_VP6A, .type = AVMEDIA_TYPE_VIDEO, .name = "vp6a", @@ -805,21 +718,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_PCX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pcx", - .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-pcx"), - }, - { - .id = AV_CODEC_ID_SUNRAST, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sunrast", - .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_INDEO4, .type = AVMEDIA_TYPE_VIDEO, .name = "indeo4", @@ -855,6 +753,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_DAALA, + .type = AVMEDIA_TYPE_VIDEO, + .name = "daala", + .long_name = NULL_IF_CONFIG_SMALL("Daala"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_DIRAC, .type = AVMEDIA_TYPE_VIDEO, .name = "dirac", @@ -939,13 +844,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_DPX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dpx", - .long_name = NULL_IF_CONFIG_SMALL("DPX (Digital Picture Exchange) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_MAD, .type = AVMEDIA_TYPE_VIDEO, .name = "mad", @@ -1023,6 +921,14 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_VP9, + .type = AVMEDIA_TYPE_VIDEO, + .name = "vp9", + .long_name = NULL_IF_CONFIG_SMALL("Google VP9"), + .props = AV_CODEC_PROP_LOSSY, + .profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles), + }, + { .id = AV_CODEC_ID_PICTOR, .type = AVMEDIA_TYPE_VIDEO, .name = "pictor", @@ -1030,13 +936,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_ANSI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ansi", - .long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"), - .props = AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_A64_MULTI, .type = AVMEDIA_TYPE_VIDEO, .name = "a64_multi", @@ -1058,6 +957,27 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_M101, + .type = AVMEDIA_TYPE_VIDEO, + .name = "m101", + .long_name = NULL_IF_CONFIG_SMALL("Matrox Uncompressed SD"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_MVC1, + .type = AVMEDIA_TYPE_VIDEO, + .name = "mvc1", + .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 1"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_MVC2, + .type = AVMEDIA_TYPE_VIDEO, + .name = "mvc2", + .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 2"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { .id = AV_CODEC_ID_MXPEG, .type = AVMEDIA_TYPE_VIDEO, .name = "mxpeg", @@ -1093,20 +1013,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_WMV3IMAGE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wmv3image", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VC1IMAGE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vc1image", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_UTVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "utvideo", @@ -1142,14 +1048,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_XWD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xwd", - .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-xwindowdump"), - }, - { .id = AV_CODEC_ID_CDXL, .type = AVMEDIA_TYPE_VIDEO, .name = "cdxl", @@ -1157,14 +1055,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_XBM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xbm", - .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-xbitmap"), - }, - { .id = AV_CODEC_ID_ZEROCODEC, .type = AVMEDIA_TYPE_VIDEO, .name = "zerocodec", @@ -1214,14 +1104,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_VP9, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp9", - .long_name = NULL_IF_CONFIG_SMALL("Google VP9"), - .props = AV_CODEC_PROP_LOSSY, - .profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles), - }, - { .id = AV_CODEC_ID_AIC, .type = AVMEDIA_TYPE_VIDEO, .name = "aic", @@ -1229,6 +1111,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_Y41P, + .type = AVMEDIA_TYPE_VIDEO, + .name = "y41p", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed YUV 4:1:1 12-bit"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_ESCAPE130, .type = AVMEDIA_TYPE_VIDEO, .name = "escape130", @@ -1236,6 +1125,88 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_AVRP, + .type = AVMEDIA_TYPE_VIDEO, + .name = "avrp", + .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_012V, + .type = AVMEDIA_TYPE_VIDEO, + .name = "012v", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_AVUI, + .type = AVMEDIA_TYPE_VIDEO, + .name = "avui", + .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_AYUV, + .type = AVMEDIA_TYPE_VIDEO, + .name = "ayuv", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_TARGA_Y216, + .type = AVMEDIA_TYPE_VIDEO, + .name = "targa_y216", + .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_V308, + .type = AVMEDIA_TYPE_VIDEO, + .name = "v308", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_V408, + .type = AVMEDIA_TYPE_VIDEO, + .name = "v408", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_YUV4, + .type = AVMEDIA_TYPE_VIDEO, + .name = "yuv4", + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_AVRN, + .type = AVMEDIA_TYPE_VIDEO, + .name = "avrn", + .long_name = NULL_IF_CONFIG_SMALL("Avid AVI Codec"), + }, + { + .id = AV_CODEC_ID_CPIA, + .type = AVMEDIA_TYPE_VIDEO, + .name = "cpia", + .long_name = NULL_IF_CONFIG_SMALL("CPiA video format"), + }, + { + .id = AV_CODEC_ID_XFACE, + .type = AVMEDIA_TYPE_VIDEO, + .name = "xface", + .long_name = NULL_IF_CONFIG_SMALL("X-face image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_SMVJPEG, + .type = AVMEDIA_TYPE_VIDEO, + .name = "smvjpeg", + .long_name = NULL_IF_CONFIG_SMALL("Sigmatel Motion Video"), + }, + + { .id = AV_CODEC_ID_G2M, .type = AVMEDIA_TYPE_VIDEO, .name = "g2m", @@ -1243,15 +1214,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_WEBP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "webp", - .long_name = NULL_IF_CONFIG_SMALL("WebP"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/webp"), - }, - { .id = AV_CODEC_ID_HNM4_VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "hnm4video", @@ -1274,20 +1236,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_ALIAS_PIX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "alias_pix", - .long_name = NULL_IF_CONFIG_SMALL("Alias/Wavefront PIX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_BRENDER_PIX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "brender_pix", - .long_name = NULL_IF_CONFIG_SMALL("BRender PIX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_PAF_VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "paf_video", @@ -1295,14 +1243,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_EXR, - .type = AVMEDIA_TYPE_VIDEO, - .name = "exr", - .long_name = NULL_IF_CONFIG_SMALL("OpenEXR image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_VP7, .type = AVMEDIA_TYPE_VIDEO, .name = "vp7", @@ -1324,20 +1264,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_MVC1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mvc1", - .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 1"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MVC2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mvc2", - .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 2"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_HQX, .type = AVMEDIA_TYPE_VIDEO, .name = "hqx", @@ -1345,13 +1271,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_TDSC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tdsc", - .long_name = NULL_IF_CONFIG_SMALL("TDSC"), - .props = AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_HQ_HQA, .type = AVMEDIA_TYPE_VIDEO, .name = "hq_hqa", @@ -1366,14 +1285,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_DDS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dds", - .long_name = NULL_IF_CONFIG_SMALL("DirectDraw Surface image decoder"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_DXV, .type = AVMEDIA_TYPE_VIDEO, .name = "dxv", @@ -1388,6 +1299,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_SPEEDHQ, + .type = AVMEDIA_TYPE_VIDEO, + .name = "speedhq", + .long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_WRAPPED_AVFRAME, + .type = AVMEDIA_TYPE_VIDEO, + .name = "wrapped_avframe", + .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_RSCC, .type = AVMEDIA_TYPE_VIDEO, .name = "rscc", @@ -1395,155 +1320,229 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_Y41P, + .id = AV_CODEC_ID_MAGICYUV, .type = AVMEDIA_TYPE_VIDEO, - .name = "y41p", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed YUV 4:1:1 12-bit"), + .name = "magicyuv", + .long_name = NULL_IF_CONFIG_SMALL("MagicYUV video"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_AVRP, + .id = AV_CODEC_ID_TRUEMOTION2RT, .type = AVMEDIA_TYPE_VIDEO, - .name = "avrp", - .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .name = "truemotion2rt", + .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"), + .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_012V, + .id = AV_CODEC_ID_CFHD, .type = AVMEDIA_TYPE_VIDEO, - .name = "012v", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .name = "cfhd", + .long_name = NULL_IF_CONFIG_SMALL("Cineform HD"), + .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_AVUI, + .id = AV_CODEC_ID_SHEERVIDEO, .type = AVMEDIA_TYPE_VIDEO, - .name = "avui", - .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"), + .name = "sheervideo", + .long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_AYUV, + .id = AV_CODEC_ID_YLC, .type = AVMEDIA_TYPE_VIDEO, - .name = "ayuv", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"), + .name = "ylc", + .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_TARGA_Y216, + .id = AV_CODEC_ID_PIXLET, .type = AVMEDIA_TYPE_VIDEO, - .name = "targa_y216", - .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"), + .name = "pixlet", + .long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_FMVC, + .type = AVMEDIA_TYPE_VIDEO, + .name = "fmvc", + .long_name = NULL_IF_CONFIG_SMALL("FM Screen Capture Codec"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_SCPR, + .type = AVMEDIA_TYPE_VIDEO, + .name = "scpr", + .long_name = NULL_IF_CONFIG_SMALL("ScreenPressor"), + .props = AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_CLEARVIDEO, + .type = AVMEDIA_TYPE_VIDEO, + .name = "clearvideo", + .long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_AV1, + .type = AVMEDIA_TYPE_VIDEO, + .name = "av1", + .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_BITPACKED, + .type = AVMEDIA_TYPE_VIDEO, + .name = "bitpacked", + .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_V308, + .id = AV_CODEC_ID_MSCC, .type = AVMEDIA_TYPE_VIDEO, - .name = "v308", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"), + .name = "mscc", + .long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_V408, + .id = AV_CODEC_ID_SRGC, .type = AVMEDIA_TYPE_VIDEO, - .name = "v408", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"), + .name = "srgc", + .long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_YUV4, + .id = AV_CODEC_ID_GDV, .type = AVMEDIA_TYPE_VIDEO, - .name = "yuv4", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"), + .name = "gdv", + .long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"), + .props = AV_CODEC_PROP_LOSSY, + }, + + /* image codecs */ + { + .id = AV_CODEC_ID_ALIAS_PIX, + .type = AVMEDIA_TYPE_VIDEO, + .name = "alias_pix", + .long_name = NULL_IF_CONFIG_SMALL("Alias/Wavefront PIX image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_AVRN, + .id = AV_CODEC_ID_ANSI, .type = AVMEDIA_TYPE_VIDEO, - .name = "avrn", - .long_name = NULL_IF_CONFIG_SMALL("Avid AVI Codec"), + .name = "ansi", + .long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"), + .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_CPIA, + .id = AV_CODEC_ID_BRENDER_PIX, .type = AVMEDIA_TYPE_VIDEO, - .name = "cpia", - .long_name = NULL_IF_CONFIG_SMALL("CPiA video format"), + .name = "brender_pix", + .long_name = NULL_IF_CONFIG_SMALL("BRender PIX image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_XFACE, + .id = AV_CODEC_ID_DDS, .type = AVMEDIA_TYPE_VIDEO, - .name = "xface", - .long_name = NULL_IF_CONFIG_SMALL("X-face image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + .name = "dds", + .long_name = NULL_IF_CONFIG_SMALL("DirectDraw Surface image decoder"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_SNOW, + .id = AV_CODEC_ID_DPX, .type = AVMEDIA_TYPE_VIDEO, - .name = "snow", - .long_name = NULL_IF_CONFIG_SMALL("Snow"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, + .name = "dpx", + .long_name = NULL_IF_CONFIG_SMALL("DPX (Digital Picture Exchange) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_SMVJPEG, + .id = AV_CODEC_ID_EXR, .type = AVMEDIA_TYPE_VIDEO, - .name = "smvjpeg", - .long_name = NULL_IF_CONFIG_SMALL("Sigmatel Motion Video"), + .name = "exr", + .long_name = NULL_IF_CONFIG_SMALL("OpenEXR image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_APNG, + .id = AV_CODEC_ID_FITS, .type = AVMEDIA_TYPE_VIDEO, - .name = "apng", - .long_name = NULL_IF_CONFIG_SMALL("APNG (Animated Portable Network Graphics) image"), + .name = "fits", + .long_name = NULL_IF_CONFIG_SMALL("FITS (Flexible Image Transport System)"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_GIF, + .type = AVMEDIA_TYPE_VIDEO, + .name = "gif", + .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"), .props = AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/png"), + .mime_types= MT("image/gif"), }, { - .id = AV_CODEC_ID_DAALA, + .id = AV_CODEC_ID_JPEGLS, .type = AVMEDIA_TYPE_VIDEO, - .name = "daala", - .long_name = NULL_IF_CONFIG_SMALL("Daala"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, + .name = "jpegls", + .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_CFHD, + .id = AV_CODEC_ID_LJPEG, .type = AVMEDIA_TYPE_VIDEO, - .name = "cfhd", - .long_name = NULL_IF_CONFIG_SMALL("Cineform HD"), - .props = AV_CODEC_PROP_LOSSY, + .name = "ljpeg", + .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_TRUEMOTION2RT, + .id = AV_CODEC_ID_PAM, .type = AVMEDIA_TYPE_VIDEO, - .name = "truemotion2rt", - .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"), - .props = AV_CODEC_PROP_LOSSY, + .name = "pam", + .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-portable-pixmap"), }, { - .id = AV_CODEC_ID_M101, + .id = AV_CODEC_ID_PBM, .type = AVMEDIA_TYPE_VIDEO, - .name = "m101", - .long_name = NULL_IF_CONFIG_SMALL("Matrox Uncompressed SD"), + .name = "pbm", + .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_MAGICYUV, + .id = AV_CODEC_ID_PCX, .type = AVMEDIA_TYPE_VIDEO, - .name = "magicyuv", - .long_name = NULL_IF_CONFIG_SMALL("MagicYUV video"), + .name = "pcx", + .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-pcx"), }, { - .id = AV_CODEC_ID_SHEERVIDEO, + .id = AV_CODEC_ID_PGM, .type = AVMEDIA_TYPE_VIDEO, - .name = "sheervideo", - .long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"), + .name = "pgm", + .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_YLC, + .id = AV_CODEC_ID_PGMYUV, .type = AVMEDIA_TYPE_VIDEO, - .name = "ylc", - .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"), + .name = "pgmyuv", + .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_PNG, + .type = AVMEDIA_TYPE_VIDEO, + .name = "png", + .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), + .props = AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/png"), + }, + { + .id = AV_CODEC_ID_PPM, + .type = AVMEDIA_TYPE_VIDEO, + .name = "ppm", + .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { @@ -1554,98 +1553,117 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_PIXLET, + .id = AV_CODEC_ID_PTX, .type = AVMEDIA_TYPE_VIDEO, - .name = "pixlet", - .long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"), + .name = "ptx", + .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_SPEEDHQ, + .id = AV_CODEC_ID_SGI, .type = AVMEDIA_TYPE_VIDEO, - .name = "speedhq", - .long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"), + .name = "sgi", + .long_name = NULL_IF_CONFIG_SMALL("SGI image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_SP5X, + .type = AVMEDIA_TYPE_VIDEO, + .name = "sp5x", + .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_FMVC, + .id = AV_CODEC_ID_SUNRAST, .type = AVMEDIA_TYPE_VIDEO, - .name = "fmvc", - .long_name = NULL_IF_CONFIG_SMALL("FM Screen Capture Codec"), - .props = AV_CODEC_PROP_LOSSLESS, + .name = "sunrast", + .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_SCPR, + .id = AV_CODEC_ID_TARGA, .type = AVMEDIA_TYPE_VIDEO, - .name = "scpr", - .long_name = NULL_IF_CONFIG_SMALL("ScreenPressor"), - .props = AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_LOSSY, + .name = "targa", + .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-targa", "image/x-tga"), }, { - .id = AV_CODEC_ID_CLEARVIDEO, + .id = AV_CODEC_ID_TDSC, .type = AVMEDIA_TYPE_VIDEO, - .name = "clearvideo", - .long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"), + .name = "tdsc", + .long_name = NULL_IF_CONFIG_SMALL("TDSC"), .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_XPM, + .id = AV_CODEC_ID_TIFF, .type = AVMEDIA_TYPE_VIDEO, - .name = "xpm", - .long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"), + .name = "tiff", + .long_name = NULL_IF_CONFIG_SMALL("TIFF image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/x-xpixmap"), + .mime_types= MT("image/tiff"), }, { - .id = AV_CODEC_ID_AV1, + .id = AV_CODEC_ID_TXD, .type = AVMEDIA_TYPE_VIDEO, - .name = "av1", - .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"), + .name = "txd", + .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_VC1IMAGE, + .type = AVMEDIA_TYPE_VIDEO, + .name = "vc1image", + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"), .props = AV_CODEC_PROP_LOSSY, - .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), }, { - .id = AV_CODEC_ID_BITPACKED, + .id = AV_CODEC_ID_WEBP, .type = AVMEDIA_TYPE_VIDEO, - .name = "bitpacked", - .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .name = "webp", + .long_name = NULL_IF_CONFIG_SMALL("WebP"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/webp"), }, { - .id = AV_CODEC_ID_MSCC, + .id = AV_CODEC_ID_WMV3IMAGE, .type = AVMEDIA_TYPE_VIDEO, - .name = "mscc", - .long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .name = "wmv3image", + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"), + .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_SRGC, + .id = AV_CODEC_ID_XBM, .type = AVMEDIA_TYPE_VIDEO, - .name = "srgc", - .long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"), + .name = "xbm", + .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-xbitmap"), }, { - .id = AV_CODEC_ID_SVG, + .id = AV_CODEC_ID_XPM, .type = AVMEDIA_TYPE_VIDEO, - .name = "svg", - .long_name = NULL_IF_CONFIG_SMALL("Scalable Vector Graphics"), - .props = AV_CODEC_PROP_LOSSLESS, - .mime_types= MT("image/svg+xml"), + .name = "xpm", + .long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-xpixmap"), }, { - .id = AV_CODEC_ID_GDV, + .id = AV_CODEC_ID_XWD, .type = AVMEDIA_TYPE_VIDEO, - .name = "gdv", - .long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"), - .props = AV_CODEC_PROP_LOSSY, + .name = "xwd", + .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/x-xwindowdump"), }, { - .id = AV_CODEC_ID_FITS, + .id = AV_CODEC_ID_APNG, .type = AVMEDIA_TYPE_VIDEO, - .name = "fits", - .long_name = NULL_IF_CONFIG_SMALL("FITS (Flexible Image Transport System)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + .name = "apng", + .long_name = NULL_IF_CONFIG_SMALL("APNG (Animated Portable Network Graphics) image"), + .props = AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/png"), }, /* various PCM "codecs" */ @@ -1720,6 +1738,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_PCM_S64LE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_s64le", + .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_PCM_S64BE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_s64be", + .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_PCM_U32LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u32le", @@ -1776,6 +1808,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_PCM_S16BE_PLANAR, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_s16be_planar", + .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian planar"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_PCM_S16LE_PLANAR, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s16le_planar", @@ -1783,6 +1822,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_PCM_S24LE_PLANAR, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_s24le_planar", + .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian planar"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_PCM_S32LE_PLANAR, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_s32le_planar", + .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian planar"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_PCM_DVD, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_dvd", @@ -1790,6 +1843,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { + .id = AV_CODEC_ID_PCM_F16LE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_f16le", + .long_name = NULL_IF_CONFIG_SMALL("PCM 16.8 floating point little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_PCM_F24LE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "pcm_f24le", + .long_name = NULL_IF_CONFIG_SMALL("PCM 24.0 floating point little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_PCM_F32BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_f32be", @@ -1845,55 +1912,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"), .props = AV_CODEC_PROP_LOSSLESS, }, - { - .id = AV_CODEC_ID_PCM_S24LE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s24le_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S32LE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s32le_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S16BE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s16be_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S64LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s64le", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S64BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s64be", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F16LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f16le", - .long_name = NULL_IF_CONFIG_SMALL("PCM 16.8 floating point little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F24LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f24le", - .long_name = NULL_IF_CONFIG_SMALL("PCM 24.0 floating point little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, /* various ADPCM codecs */ { @@ -2030,6 +2048,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_ADPCM_THP_LE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_thp_le", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo THP (Little-Endian)"), + .props = AV_CODEC_PROP_LOSSY, + }, + { .id = AV_CODEC_ID_ADPCM_IMA_AMV, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_amv", @@ -2107,13 +2132,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_ADPCM_VIMA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_vima", - .long_name = NULL_IF_CONFIG_SMALL("LucasArts VIMA audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_ADPCM_AFC, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_afc", @@ -2149,10 +2167,10 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_ADPCM_THP_LE, + .id = AV_CODEC_ID_ADPCM_VIMA, .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_thp_le", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo THP (Little-Endian)"), + .name = "adpcm_vima", + .long_name = NULL_IF_CONFIG_SMALL("LucasArts VIMA audio"), .props = AV_CODEC_PROP_LOSSY, }, { @@ -2176,13 +2194,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Eurocom DAT4"), .props = AV_CODEC_PROP_LOSSY, }, - { - .id = AV_CODEC_ID_ADPCM_MTAF, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_mtaf", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM MTAF"), - .props = AV_CODEC_PROP_LOSSY, - }, /* AMR */ { @@ -2488,6 +2499,15 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 (Adaptive TRansform Acoustic Coding 3)"), .props = AV_CODEC_PROP_LOSSY, }, +#if FF_API_VOXWARE + { + .id = AV_CODEC_ID_VOXWARE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "voxware", + .long_name = NULL_IF_CONFIG_SMALL("Voxware RT29 Metasound"), + .props = AV_CODEC_PROP_LOSSY, + }, +#endif { .id = AV_CODEC_ID_APE, .type = AVMEDIA_TYPE_AUDIO, @@ -2545,6 +2565,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_ATRAC3PAL, + .type = AVMEDIA_TYPE_AUDIO, + .name = "atrac3pal", + .long_name = NULL_IF_CONFIG_SMALL("ATRAC3+ AL (Adaptive TRansform Acoustic Coding 3+ Advanced Lossless)"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { + .id = AV_CODEC_ID_ATRAC3AL, + .type = AVMEDIA_TYPE_AUDIO, + .name = "atrac3al", + .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 AL (Adaptive TRansform Acoustic Coding 3 Advanced Lossless)"), + .props = AV_CODEC_PROP_LOSSLESS, + }, + { .id = AV_CODEC_ID_EAC3, .type = AVMEDIA_TYPE_AUDIO, .name = "eac3", @@ -2637,6 +2671,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_DSS_SP, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dss_sp", + .long_name = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard Play mode (DSS SP)"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_DOLBY_E, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dolby_e", + .long_name = NULL_IF_CONFIG_SMALL("Dolby E"), + .props = AV_CODEC_PROP_LOSSY, + }, + { .id = AV_CODEC_ID_G729, .type = AVMEDIA_TYPE_AUDIO, .name = "g729", @@ -2686,6 +2734,24 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_FFWAVESYNTH, + .type = AVMEDIA_TYPE_AUDIO, + .name = "wavesynth", + .long_name = NULL_IF_CONFIG_SMALL("Wave synthesis pseudo-codec"), + }, + { + .id = AV_CODEC_ID_SONIC, + .type = AVMEDIA_TYPE_AUDIO, + .name = "sonic", + .long_name = NULL_IF_CONFIG_SMALL("Sonic"), + }, + { + .id = AV_CODEC_ID_SONIC_LS, + .type = AVMEDIA_TYPE_AUDIO, + .name = "sonicls", + .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"), + }, + { .id = AV_CODEC_ID_OPUS, .type = AVMEDIA_TYPE_AUDIO, .name = "opus", @@ -2728,38 +2794,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_DSS_SP, - .type = AVMEDIA_TYPE_AUDIO, - .name = "dss_sp", - .long_name = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard Play mode (DSS SP)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CODEC2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "codec2", - .long_name = NULL_IF_CONFIG_SMALL("codec2 (very low bitrate speech codec)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FFWAVESYNTH, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wavesynth", - .long_name = NULL_IF_CONFIG_SMALL("Wave synthesis pseudo-codec"), - }, - { - .id = AV_CODEC_ID_SONIC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sonic", - .long_name = NULL_IF_CONFIG_SMALL("Sonic"), - }, - { - .id = AV_CODEC_ID_SONIC_LS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sonicls", - .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"), - }, - { .id = AV_CODEC_ID_EVRC, .type = AVMEDIA_TYPE_AUDIO, .name = "evrc", @@ -2774,6 +2808,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { + .id = AV_CODEC_ID_4GV, + .type = AVMEDIA_TYPE_AUDIO, + .name = "4gv", + .long_name = NULL_IF_CONFIG_SMALL("4GV (Fourth Generation Vocoder)"), + .props = AV_CODEC_PROP_LOSSY, + }, + { .id = AV_CODEC_ID_DSD_LSBF, .type = AVMEDIA_TYPE_AUDIO, .name = "dsd_lsbf", @@ -2802,13 +2843,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_4GV, - .type = AVMEDIA_TYPE_AUDIO, - .name = "4gv", - .long_name = NULL_IF_CONFIG_SMALL("4GV (Fourth Generation Vocoder)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { .id = AV_CODEC_ID_INTERPLAY_ACM, .type = AVMEDIA_TYPE_AUDIO, .name = "interplayacm", @@ -2837,45 +2871,10 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_LOSSLESS, }, { - .id = AV_CODEC_ID_ATRAC3AL, - .type = AVMEDIA_TYPE_AUDIO, - .name = "atrac3al", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 AL (Adaptive TRansform Acoustic Coding 3 Advanced Lossless)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ATRAC3PAL, - .type = AVMEDIA_TYPE_AUDIO, - .name = "atrac3pal", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3+ AL (Adaptive TRansform Acoustic Coding 3+ Advanced Lossless)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DOLBY_E, - .type = AVMEDIA_TYPE_AUDIO, - .name = "dolby_e", - .long_name = NULL_IF_CONFIG_SMALL("Dolby E"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_APTX, - .type = AVMEDIA_TYPE_AUDIO, - .name = "aptx", - .long_name = NULL_IF_CONFIG_SMALL("aptX (Audio Processing Technology for Bluetooth)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_APTX_HD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "aptx_hd", - .long_name = NULL_IF_CONFIG_SMALL("aptX HD (Audio Processing Technology for Bluetooth)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SBC, + .id = AV_CODEC_ID_ADPCM_MTAF, .type = AVMEDIA_TYPE_AUDIO, - .name = "sbc", - .long_name = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband codec)"), + .name = "adpcm_mtaf", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM MTAF"), .props = AV_CODEC_PROP_LOSSY, }, @@ -2909,6 +2908,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_BITMAP_SUB, }, { + .id = AV_CODEC_ID_ASS, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "ass", + .long_name = NULL_IF_CONFIG_SMALL("ASS (Advanced SSA) subtitle"), + .props = AV_CODEC_PROP_TEXT_SUB, + }, + { .id = AV_CODEC_ID_SSA, .type = AVMEDIA_TYPE_SUBTITLE, .name = "ssa", @@ -2943,6 +2949,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_TEXT_SUB, }, { + .id = AV_CODEC_ID_SUBRIP, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "subrip", + .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), + .props = AV_CODEC_PROP_TEXT_SUB, + }, + { .id = AV_CODEC_ID_MICRODVD, .type = AVMEDIA_TYPE_SUBTITLE, .name = "microdvd", @@ -2950,6 +2963,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_TEXT_SUB, }, { + .id = AV_CODEC_ID_MPL2, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "mpl2", + .long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitle"), + .props = AV_CODEC_PROP_TEXT_SUB, + }, + { .id = AV_CODEC_ID_EIA_608, .type = AVMEDIA_TYPE_SUBTITLE, .name = "eia_608", @@ -2964,6 +2984,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_TEXT_SUB, }, { + .id = AV_CODEC_ID_PJS, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "pjs", + .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"), + .props = AV_CODEC_PROP_TEXT_SUB, + }, + { .id = AV_CODEC_ID_SAMI, .type = AVMEDIA_TYPE_SUBTITLE, .name = "sami", @@ -2999,27 +3026,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_TEXT_SUB, }, { - .id = AV_CODEC_ID_SUBRIP, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "subrip", - .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_WEBVTT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "webvtt", - .long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_MPL2, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "mpl2", - .long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { .id = AV_CODEC_ID_VPLAYER, .type = AVMEDIA_TYPE_SUBTITLE, .name = "vplayer", @@ -3027,17 +3033,10 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_TEXT_SUB, }, { - .id = AV_CODEC_ID_PJS, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "pjs", - .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_ASS, + .id = AV_CODEC_ID_WEBVTT, .type = AVMEDIA_TYPE_SUBTITLE, - .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("ASS (Advanced SSA) subtitle"), + .name = "webvtt", + .long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"), .props = AV_CODEC_PROP_TEXT_SUB, }, { @@ -3057,12 +3056,6 @@ static const AVCodecDescriptor codec_descriptors[] = { .mime_types= MT("application/x-truetype-font", "application/x-font"), }, { - .id = AV_CODEC_ID_SCTE_35, - .type = AVMEDIA_TYPE_DATA, - .name = "scte_35", - .long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"), - }, - { .id = AV_CODEC_ID_BINTEXT, .type = AVMEDIA_TYPE_VIDEO, .name = "bintext", @@ -3116,26 +3109,23 @@ static const AVCodecDescriptor codec_descriptors[] = { .mime_types= MT("application/octet-stream"), }, { - .id = AV_CODEC_ID_WRAPPED_AVFRAME, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wrapped_avframe", - .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), - .props = AV_CODEC_PROP_LOSSLESS, + .id = AV_CODEC_ID_SCTE_35, + .type = AVMEDIA_TYPE_DATA, + .name = "scte_35", + .long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"), }, -}; - -static int descriptor_compare(const void *key, const void *member) -{ - enum AVCodecID id = *(const enum AVCodecID *) key; - const AVCodecDescriptor *desc = member; - return id - desc->id; -} + /* deprecated codec ids */ +}; const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id) { - return bsearch(&id, codec_descriptors, FF_ARRAY_ELEMS(codec_descriptors), - sizeof(codec_descriptors[0]), descriptor_compare); + int i; + + for (i = 0; i < FF_ARRAY_ELEMS(codec_descriptors); i++) + if (codec_descriptors[i].id == id) + return &codec_descriptors[i]; + return NULL; } const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev) diff --git a/media/ffvpx/libavcodec/codec_list.c b/media/ffvpx/libavcodec/codec_list.c deleted file mode 100644 index 063f8ff78..000000000 --- a/media/ffvpx/libavcodec/codec_list.c +++ /dev/null @@ -1,11 +0,0 @@ -static const AVCodec * const codec_list[] = { -#if CONFIG_VP8_DECODER - &ff_vp8_decoder, -#endif -#if CONFIG_VP9_DECODER - &ff_vp9_decoder, -#endif -#if CONFIG_FLAC_DECODER - &ff_flac_decoder, -#endif - NULL }; diff --git a/media/ffvpx/libavcodec/decode.c b/media/ffvpx/libavcodec/decode.c index 421a8f1a3..fb1824be1 100644 --- a/media/ffvpx/libavcodec/decode.c +++ b/media/ffvpx/libavcodec/decode.c @@ -40,7 +40,6 @@ #include "avcodec.h" #include "bytestream.h" #include "decode.h" -#include "hwaccel.h" #include "internal.h" #include "thread.h" @@ -130,7 +129,7 @@ static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt) if (pkt) { ret = av_packet_copy_props(avci->last_pkt_props, pkt); if (!ret) - avci->last_pkt_props->size = pkt->size; // HACK: Needed for ff_decode_frame_props(). + avci->last_pkt_props->size = pkt->size; // HACK: Needed for ff_init_buffer_info(). } return ret; } @@ -370,7 +369,8 @@ static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame) DecodeSimpleContext *ds = &avci->ds; AVPacket *pkt = ds->in_pkt; // copy to ensure we do not change pkt - int got_frame, actual_got_frame; + AVPacket tmp; + int got_frame, actual_got_frame, did_split; int ret; if (!pkt->data && !avci->draining) { @@ -390,12 +390,31 @@ static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame) avctx->active_thread_type & FF_THREAD_FRAME)) return AVERROR_EOF; + tmp = *pkt; +#if FF_API_MERGE_SD +FF_DISABLE_DEPRECATION_WARNINGS + did_split = avci->compat_decode_partial_size ? + ff_packet_split_and_drop_side_data(&tmp) : + av_packet_split_side_data(&tmp); + + if (did_split) { + ret = extract_packet_props(avctx->internal, &tmp); + if (ret < 0) + return ret; + + ret = apply_param_change(avctx, &tmp); + if (ret < 0) + return ret; + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + got_frame = 0; if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) { - ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt); + ret = ff_thread_decode_frame(avctx, frame, &got_frame, &tmp); } else { - ret = avctx->codec->decode(avctx, frame, &got_frame, pkt); + ret = avctx->codec->decode(avctx, frame, &got_frame, &tmp); if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) frame->pkt_dts = pkt->dts; @@ -525,6 +544,13 @@ FF_ENABLE_DEPRECATION_WARNINGS } } } +#if FF_API_MERGE_SD + if (did_split) { + av_packet_free_side_data(&tmp); + if(ret == tmp.size) + ret = pkt->size; + } +#endif if (avctx->codec->type == AVMEDIA_TYPE_AUDIO && !avci->showed_multi_packet_warning && @@ -614,28 +640,6 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (ret == AVERROR_EOF) avci->draining_done = 1; - if (!ret) { - /* the only case where decode data is not set should be decoders - * that do not call ff_get_buffer() */ - av_assert0((frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) || - !(avctx->codec->capabilities & AV_CODEC_CAP_DR1)); - - if (frame->private_ref) { - FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; - - if (fdd->post_process) { - ret = fdd->post_process(avctx, frame); - if (ret < 0) { - av_frame_unref(frame); - return ret; - } - } - } - } - - /* free the per-frame decode data */ - av_buffer_unref(&frame->private_ref); - return ret; } @@ -1000,6 +1004,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, AVPacket *avpkt) { int i, ret = 0; + AVCodecInternal *avci = avctx->internal; if (!avpkt->data && avpkt->size) { av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); @@ -1016,9 +1021,29 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, get_subtitle_defaults(sub); if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) { - AVPacket pkt_recoded = *avpkt; + AVPacket pkt_recoded; + AVPacket tmp = *avpkt; +#if FF_API_MERGE_SD +FF_DISABLE_DEPRECATION_WARNINGS + int did_split = avci->compat_decode_partial_size ? + ff_packet_split_and_drop_side_data(&tmp) : + av_packet_split_side_data(&tmp); + //apply_param_change(avctx, &tmp); + + if (did_split) { + /* FFMIN() prevents overflow in case the packet wasn't allocated with + * proper padding. + * If the side data is smaller than the buffer padding size, the + * remaining bytes should have already been filled with zeros by the + * original packet allocation anyway. */ + memset(tmp.data + tmp.size, 0, + FFMIN(avpkt->size - tmp.size, AV_INPUT_BUFFER_PADDING_SIZE)); + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif - ret = recode_subtitle(avctx, &pkt_recoded, avpkt); + pkt_recoded = tmp; + ret = recode_subtitle(avctx, &pkt_recoded, &tmp); if (ret < 0) { *got_sub_ptr = 0; } else { @@ -1057,8 +1082,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, sub->format = 1; for (i = 0; i < sub->num_rects; i++) { - if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_IGNORE && - sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) { + if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) { av_log(avctx, AV_LOG_ERROR, "Invalid UTF-8 in decoded subtitles text; " "maybe missing -sub_charenc option\n"); @@ -1068,7 +1092,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, } } - if (avpkt->data != pkt_recoded.data) { // did we recode? + if (tmp.data != pkt_recoded.data) { // did we recode? /* prevent from destroying side data from original packet */ pkt_recoded.side_data = NULL; pkt_recoded.side_data_elems = 0; @@ -1077,6 +1101,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, } } +#if FF_API_MERGE_SD + if (did_split) { + av_packet_free_side_data(&tmp); + if(ret == tmp.size) + ret = avpkt->size; + } +#endif + if (*got_sub_ptr) avctx->frame_number++; } @@ -1084,238 +1116,84 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, return ret; } -enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx, - const enum AVPixelFormat *fmt) +static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) { - const AVPixFmtDescriptor *desc; - const AVCodecHWConfig *config; - int i, n; - - // If a device was supplied when the codec was opened, assume that the - // user wants to use it. - if (avctx->hw_device_ctx && avctx->codec->hw_configs) { - AVHWDeviceContext *device_ctx = - (AVHWDeviceContext*)avctx->hw_device_ctx->data; - for (i = 0;; i++) { - config = &avctx->codec->hw_configs[i]->public; - if (!config) - break; - if (!(config->methods & - AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) - continue; - if (device_ctx->type != config->device_type) - continue; - for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) { - if (config->pix_fmt == fmt[n]) - return fmt[n]; - } - } - } - // No device or other setup, so we have to choose from things which - // don't any other external information. - - // If the last element of the list is a software format, choose it - // (this should be best software format if any exist). - for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++); - desc = av_pix_fmt_desc_get(fmt[n - 1]); - if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) - return fmt[n - 1]; - - // Finally, traverse the list in order and choose the first entry - // with no external dependencies (if there is no hardware configuration - // information available then this just picks the first entry). - for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) { - for (i = 0;; i++) { - config = avcodec_get_hw_config(avctx->codec, i); - if (!config) - break; - if (config->pix_fmt == fmt[n]) - break; - } - if (!config) { - // No specific config available, so the decoder must be able - // to handle this format without any additional setup. - return fmt[n]; - } - if (config->methods & AV_CODEC_HW_CONFIG_METHOD_INTERNAL) { - // Usable with only internal setup. - return fmt[n]; - } - } - - // Nothing is usable, give up. - return AV_PIX_FMT_NONE; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + return desc->flags & AV_PIX_FMT_FLAG_HWACCEL; } -int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, - enum AVHWDeviceType dev_type) +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt) { - AVHWDeviceContext *device_ctx; - AVHWFramesContext *frames_ctx; - int ret; - - if (!avctx->hwaccel) - return AVERROR(ENOSYS); - - if (avctx->hw_frames_ctx) - return 0; - if (!avctx->hw_device_ctx) { - av_log(avctx, AV_LOG_ERROR, "A hardware frames or device context is " - "required for hardware accelerated decoding.\n"); - return AVERROR(EINVAL); - } - - device_ctx = (AVHWDeviceContext *)avctx->hw_device_ctx->data; - if (device_ctx->type != dev_type) { - av_log(avctx, AV_LOG_ERROR, "Device type %s expected for hardware " - "decoding, but got %s.\n", av_hwdevice_get_type_name(dev_type), - av_hwdevice_get_type_name(device_ctx->type)); - return AVERROR(EINVAL); - } - - ret = avcodec_get_hw_frames_parameters(avctx, - avctx->hw_device_ctx, - avctx->hwaccel->pix_fmt, - &avctx->hw_frames_ctx); - if (ret < 0) - return ret; - - frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; - - - if (frames_ctx->initial_pool_size) { - // We guarantee 4 base work surfaces. The function above guarantees 1 - // (the absolute minimum), so add the missing count. - frames_ctx->initial_pool_size += 3; - } + while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt)) + ++fmt; + return fmt[0]; +} - ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); - if (ret < 0) { - av_buffer_unref(&avctx->hw_frames_ctx); - return ret; - } +static AVHWAccel *find_hwaccel(enum AVCodecID codec_id, + enum AVPixelFormat pix_fmt) +{ + AVHWAccel *hwaccel = NULL; - return 0; + while ((hwaccel = av_hwaccel_next(hwaccel))) + if (hwaccel->id == codec_id + && hwaccel->pix_fmt == pix_fmt) + return hwaccel; + return NULL; } -int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, - AVBufferRef *device_ref, - enum AVPixelFormat hw_pix_fmt, - AVBufferRef **out_frames_ref) +static int setup_hwaccel(AVCodecContext *avctx, + const enum AVPixelFormat fmt, + const char *name) { - AVBufferRef *frames_ref = NULL; - const AVCodecHWConfigInternal *hw_config; - const AVHWAccel *hwa; - int i, ret; + AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt); + int ret = 0; - for (i = 0;; i++) { - hw_config = avctx->codec->hw_configs[i]; - if (!hw_config) - return AVERROR(ENOENT); - if (hw_config->public.pix_fmt == hw_pix_fmt) - break; - } - - hwa = hw_config->hwaccel; - if (!hwa || !hwa->frame_params) + if (!hwa) { + av_log(avctx, AV_LOG_ERROR, + "Could not find an AVHWAccel for the pixel format: %s", + name); return AVERROR(ENOENT); - - frames_ref = av_hwframe_ctx_alloc(device_ref); - if (!frames_ref) - return AVERROR(ENOMEM); - - ret = hwa->frame_params(avctx, frames_ref); - if (ret >= 0) { - AVHWFramesContext *frames_ctx = (AVHWFramesContext*)frames_ref->data; - - if (frames_ctx->initial_pool_size) { - // If the user has requested that extra output surfaces be - // available then add them here. - if (avctx->extra_hw_frames > 0) - frames_ctx->initial_pool_size += avctx->extra_hw_frames; - - // If frame threading is enabled then an extra surface per thread - // is also required. - if (avctx->active_thread_type & FF_THREAD_FRAME) - frames_ctx->initial_pool_size += avctx->thread_count; - } - - *out_frames_ref = frames_ref; - } else { - av_buffer_unref(&frames_ref); } - return ret; -} - -static int hwaccel_init(AVCodecContext *avctx, - const AVCodecHWConfigInternal *hw_config) -{ - const AVHWAccel *hwaccel; - int err; - hwaccel = hw_config->hwaccel; - if (hwaccel->capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL && + if (hwa->capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n", - hwaccel->name); + hwa->name); return AVERROR_PATCHWELCOME; } - if (hwaccel->priv_data_size) { - avctx->internal->hwaccel_priv_data = - av_mallocz(hwaccel->priv_data_size); + if (hwa->priv_data_size) { + avctx->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size); if (!avctx->internal->hwaccel_priv_data) return AVERROR(ENOMEM); } - avctx->hwaccel = hwaccel; - if (hwaccel->init) { - err = hwaccel->init(avctx); - if (err < 0) { - av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: " - "hwaccel initialisation returned error.\n", - av_get_pix_fmt_name(hw_config->public.pix_fmt)); + avctx->hwaccel = hwa; + if (hwa->init) { + ret = hwa->init(avctx); + if (ret < 0) { av_freep(&avctx->internal->hwaccel_priv_data); avctx->hwaccel = NULL; - return err; + return ret; } } return 0; } -static void hwaccel_uninit(AVCodecContext *avctx) -{ - if (avctx->hwaccel && avctx->hwaccel->uninit) - avctx->hwaccel->uninit(avctx); - - av_freep(&avctx->internal->hwaccel_priv_data); - - avctx->hwaccel = NULL; - - av_buffer_unref(&avctx->hw_frames_ctx); -} - int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) { const AVPixFmtDescriptor *desc; enum AVPixelFormat *choices; - enum AVPixelFormat ret, user_choice; - const AVCodecHWConfigInternal *hw_config; - const AVCodecHWConfig *config; - int i, n, err; - - // Find end of list. - for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++); - // Must contain at least one entry. + enum AVPixelFormat ret; + unsigned n = 0; + + while (fmt[n] != AV_PIX_FMT_NONE) + ++n; + av_assert0(n >= 1); - // If a software format is available, it must be the last entry. - desc = av_pix_fmt_desc_get(fmt[n - 1]); - if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) { - // No software format is available. - } else { - avctx->sw_pix_fmt = fmt[n - 1]; - } + avctx->sw_pix_fmt = fmt[n - 1]; + av_assert2(!is_hwaccel_pix_fmt(avctx->sw_pix_fmt)); choices = av_malloc_array(n + 1, sizeof(*choices)); if (!choices) @@ -1324,108 +1202,48 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) memcpy(choices, fmt, (n + 1) * sizeof(*choices)); for (;;) { - // Remove the previous hwaccel, if there was one. - hwaccel_uninit(avctx); + if (avctx->hwaccel && avctx->hwaccel->uninit) + avctx->hwaccel->uninit(avctx); + av_freep(&avctx->internal->hwaccel_priv_data); + avctx->hwaccel = NULL; - user_choice = avctx->get_format(avctx, choices); - if (user_choice == AV_PIX_FMT_NONE) { - // Explicitly chose nothing, give up. - ret = AV_PIX_FMT_NONE; - break; - } + av_buffer_unref(&avctx->hw_frames_ctx); + + ret = avctx->get_format(avctx, choices); - desc = av_pix_fmt_desc_get(user_choice); + desc = av_pix_fmt_desc_get(ret); if (!desc) { - av_log(avctx, AV_LOG_ERROR, "Invalid format returned by " - "get_format() callback.\n"); ret = AV_PIX_FMT_NONE; break; } - av_log(avctx, AV_LOG_DEBUG, "Format %s chosen by get_format().\n", - desc->name); - for (i = 0; i < n; i++) { - if (choices[i] == user_choice) - break; - } - if (i == n) { - av_log(avctx, AV_LOG_ERROR, "Invalid return from get_format(): " - "%s not in possible list.\n", desc->name); + if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; - } +#if FF_API_CAP_VDPAU + if (avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU) + break; +#endif - if (avctx->codec->hw_configs) { - for (i = 0;; i++) { - hw_config = avctx->codec->hw_configs[i]; - if (!hw_config) - break; - if (hw_config->public.pix_fmt == user_choice) - break; + if (avctx->hw_frames_ctx) { + AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; + if (hw_frames_ctx->format != ret) { + av_log(avctx, AV_LOG_ERROR, "Format returned from get_buffer() " + "does not match the format of provided AVHWFramesContext\n"); + ret = AV_PIX_FMT_NONE; + break; } - } else { - hw_config = NULL; } - if (!hw_config) { - // No config available, so no extra setup required. - ret = user_choice; + if (!setup_hwaccel(avctx, ret, desc->name)) break; - } - config = &hw_config->public; - - if (config->methods & - AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX && - avctx->hw_frames_ctx) { - const AVHWFramesContext *frames_ctx = - (AVHWFramesContext*)avctx->hw_frames_ctx->data; - if (frames_ctx->format != user_choice) { - av_log(avctx, AV_LOG_ERROR, "Invalid setup for format %s: " - "does not match the format of the provided frames " - "context.\n", desc->name); - goto try_again; - } - } else if (config->methods & - AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && - avctx->hw_device_ctx) { - const AVHWDeviceContext *device_ctx = - (AVHWDeviceContext*)avctx->hw_device_ctx->data; - if (device_ctx->type != config->device_type) { - av_log(avctx, AV_LOG_ERROR, "Invalid setup for format %s: " - "does not match the type of the provided device " - "context.\n", desc->name); - goto try_again; - } - } else if (config->methods & - AV_CODEC_HW_CONFIG_METHOD_INTERNAL) { - // Internal-only setup, no additional configuration. - } else if (config->methods & - AV_CODEC_HW_CONFIG_METHOD_AD_HOC) { - // Some ad-hoc configuration we can't see and can't check. - } else { - av_log(avctx, AV_LOG_ERROR, "Invalid setup for format %s: " - "missing configuration.\n", desc->name); - goto try_again; - } - if (hw_config->hwaccel) { - av_log(avctx, AV_LOG_DEBUG, "Format %s requires hwaccel " - "initialisation.\n", desc->name); - err = hwaccel_init(avctx, hw_config); - if (err < 0) - goto try_again; - } - ret = user_choice; - break; - try_again: - av_log(avctx, AV_LOG_DEBUG, "Format %s not usable, retrying " - "get_format() without it.\n", desc->name); - for (i = 0; i < n; i++) { - if (choices[i] == user_choice) - break; - } - for (; i + 1 < n; i++) - choices[i] = choices[i + 1]; - --n; + /* Remove failed hwaccel from choices */ + for (n = 0; choices[n] != ret; n++) + av_assert0(choices[n] != AV_PIX_FMT_NONE); + + do + choices[n] = choices[n + 1]; + while (choices[n++] != AV_PIX_FMT_NONE); } av_freep(&choices); @@ -1614,7 +1432,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic) pic->linesize[i] = 0; } if (desc->flags & AV_PIX_FMT_FLAG_PAL || - ((desc->flags & FF_PSEUDOPAL) && pic->data[1])) + desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format); if (s->debug & FF_DEBUG_BUFFERS) @@ -1662,7 +1480,7 @@ static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame) return av_packet_unpack_dictionary(side_metadata, size, frame_md); } -int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) +int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) { const AVPacket *pkt = avctx->internal->last_pkt_props; int i; @@ -1770,6 +1588,11 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } +int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) +{ + return ff_init_buffer_info(avctx, frame); +} + static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) { if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { @@ -1779,11 +1602,12 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) int flags = desc ? desc->flags : 0; if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL)) num_planes = 2; - if ((flags & FF_PSEUDOPAL) && frame->data[1]) - num_planes = 2; for (i = 0; i < num_planes; i++) { av_assert0(frame->data[i]); } + // For now do not enforce anything for palette of pseudopal formats + if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) + num_planes = 2; // For formats without data like hwaccel allow unused pointers to be non-NULL. for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) { if (frame->data[i]) @@ -1793,43 +1617,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) } } -static void decode_data_free(void *opaque, uint8_t *data) -{ - FrameDecodeData *fdd = (FrameDecodeData*)data; - - if (fdd->post_process_opaque_free) - fdd->post_process_opaque_free(fdd->post_process_opaque); - - if (fdd->hwaccel_priv_free) - fdd->hwaccel_priv_free(fdd->hwaccel_priv); - - av_freep(&fdd); -} - -int ff_attach_decode_data(AVFrame *frame) -{ - AVBufferRef *fdd_buf; - FrameDecodeData *fdd; - - av_assert1(!frame->private_ref); - av_buffer_unref(&frame->private_ref); - - fdd = av_mallocz(sizeof(*fdd)); - if (!fdd) - return AVERROR(ENOMEM); - - fdd_buf = av_buffer_create((uint8_t*)fdd, sizeof(*fdd), decode_data_free, - NULL, AV_BUFFER_FLAG_READONLY); - if (!fdd_buf) { - av_freep(&fdd); - return AVERROR(ENOMEM); - } - - frame->private_ref = fdd_buf; - - return 0; -} - static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) { const AVHWAccel *hwaccel = avctx->hwaccel; @@ -1866,14 +1653,8 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) avctx->sw_pix_fmt = avctx->pix_fmt; ret = avctx->get_buffer2(avctx, frame, flags); - if (ret < 0) - goto end; - - validate_avframe_allocation(avctx, frame); - - ret = ff_attach_decode_data(frame); - if (ret < 0) - goto end; + if (ret >= 0) + validate_avframe_allocation(avctx, frame); end: if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions && @@ -1882,9 +1663,6 @@ end: frame->height = avctx->height; } - if (ret < 0) - av_frame_unref(frame); - return ret; } @@ -1911,6 +1689,8 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) av_frame_unref(frame); } + ff_init_buffer_info(avctx, frame); + if (!frame->data[0]) return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); diff --git a/media/ffvpx/libavcodec/decode.h b/media/ffvpx/libavcodec/decode.h index 15271c529..c9630228d 100644 --- a/media/ffvpx/libavcodec/decode.h +++ b/media/ffvpx/libavcodec/decode.h @@ -21,39 +21,9 @@ #ifndef AVCODEC_DECODE_H #define AVCODEC_DECODE_H -#include "libavutil/buffer.h" -#include "libavutil/frame.h" -#include "libavutil/hwcontext.h" - #include "avcodec.h" /** - * This struct stores per-frame lavc-internal data and is attached to it via - * private_ref. - */ -typedef struct FrameDecodeData { - /** - * The callback to perform some delayed processing on the frame right - * before it is returned to the caller. - * - * @note This code is called at some unspecified point after the frame is - * returned from the decoder's decode/receive_frame call. Therefore it cannot rely - * on AVCodecContext being in any specific state, so it does not get to - * access AVCodecContext directly at all. All the state it needs must be - * stored in the post_process_opaque object. - */ - int (*post_process)(void *logctx, AVFrame *frame); - void *post_process_opaque; - void (*post_process_opaque_free)(void *opaque); - - /** - * Per-frame private data for hwaccels. - */ - void *hwaccel_priv; - void (*hwaccel_priv_free)(void *priv); -} FrameDecodeData; - -/** * Called by decoders to get the next packet for decoding. * * @param pkt An empty packet to be filled with data. @@ -66,14 +36,4 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt); void ff_decode_bsfs_uninit(AVCodecContext *avctx); -/** - * Make sure avctx.hw_frames_ctx is set. If it's not set, the function will - * try to allocate it from hw_device_ctx. If that is not possible, an error - * message is printed, and an error code is returned. - */ -int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, - enum AVHWDeviceType dev_type); - -int ff_attach_decode_data(AVFrame *frame); - #endif /* AVCODEC_DECODE_H */ diff --git a/media/ffvpx/libavcodec/dummy_funcs.c b/media/ffvpx/libavcodec/dummy_funcs.c index ac0f0b780..21b469f7e 100644 --- a/media/ffvpx/libavcodec/dummy_funcs.c +++ b/media/ffvpx/libavcodec/dummy_funcs.c @@ -6,23 +6,27 @@ #include "avcodec.h" -typedef struct FFTContext FFTContext; typedef struct H264PredContext H264PredContext; -typedef struct RDFTContext RDFTContext; typedef struct VideoDSPContext VideoDSPContext; typedef struct VP8DSPContext VP8DSPContext; typedef struct VP9DSPContext VP9DSPContext; typedef struct FLACDSPContext FLACDSPContext; AVHWAccel ff_h263_vaapi_hwaccel; +AVHWAccel ff_h263_vdpau_hwaccel; AVHWAccel ff_h263_videotoolbox_hwaccel; AVHWAccel ff_h264_d3d11va_hwaccel; AVHWAccel ff_h264_dxva2_hwaccel; +AVHWAccel ff_h264_mmal_hwaccel; +AVHWAccel ff_h264_qsv_hwaccel; AVHWAccel ff_h264_vaapi_hwaccel; +AVHWAccel ff_h264_vda_hwaccel; +AVHWAccel ff_h264_vda_old_hwaccel; AVHWAccel ff_h264_vdpau_hwaccel; AVHWAccel ff_h264_videotoolbox_hwaccel; AVHWAccel ff_hevc_d3d11va_hwaccel; AVHWAccel ff_hevc_dxva2_hwaccel; +AVHWAccel ff_hevc_qsv_hwaccel; AVHWAccel ff_hevc_vaapi_hwaccel; AVHWAccel ff_hevc_vdpau_hwaccel; AVHWAccel ff_mpeg1_xvmc_hwaccel; @@ -31,9 +35,11 @@ AVHWAccel ff_mpeg1_videotoolbox_hwaccel; AVHWAccel ff_mpeg2_xvmc_hwaccel; AVHWAccel ff_mpeg2_d3d11va_hwaccel; AVHWAccel ff_mpeg2_dxva2_hwaccel; +AVHWAccel ff_mpeg2_qsv_hwaccel; AVHWAccel ff_mpeg2_vaapi_hwaccel; AVHWAccel ff_mpeg2_vdpau_hwaccel; AVHWAccel ff_mpeg2_videotoolbox_hwaccel; +AVHWAccel ff_mpeg4_mmal_hwaccel; AVHWAccel ff_mpeg4_vaapi_hwaccel; AVHWAccel ff_mpeg4_vdpau_hwaccel; AVHWAccel ff_mpeg4_videotoolbox_hwaccel; @@ -41,19 +47,40 @@ AVHWAccel ff_vc1_d3d11va_hwaccel; AVHWAccel ff_vc1_dxva2_hwaccel; AVHWAccel ff_vc1_vaapi_hwaccel; AVHWAccel ff_vc1_vdpau_hwaccel; +AVHWAccel ff_vc1_qsv_hwaccel; AVHWAccel ff_wmv3_d3d11va_hwaccel; AVHWAccel ff_wmv3_dxva2_hwaccel; AVHWAccel ff_wmv3_vaapi_hwaccel; AVHWAccel ff_wmv3_vdpau_hwaccel; +AVHWAccel ff_mpeg2_mmal_hwaccel; +AVHWAccel ff_vc1_mmal_hwaccel; AVHWAccel ff_vp9_d3d11va_hwaccel; AVHWAccel ff_vp9_dxva2_hwaccel; AVHWAccel ff_vp9_vaapi_hwaccel; +AVHWAccel ff_vp9_cuvid_hwaccel; +AVHWAccel ff_vp8_cuvid_hwaccel; +AVHWAccel ff_vc1_cuvid_hwaccel; +AVHWAccel ff_hevc_cuvid_hwaccel; +AVHWAccel ff_h264_cuvid_hwaccel; +/* Added by FFmpeg 3.2 */ +AVHWAccel ff_h263_cuvid_hwaccel; +AVHWAccel ff_mjpeg_cuvid_hwaccel; +AVHWAccel ff_mpeg1_cuvid_hwaccel; +AVHWAccel ff_mpeg2_cuvid_hwaccel; +AVHWAccel ff_mpeg4_cuvid_hwaccel; +AVHWAccel ff_h264_mediacodec_hwaccel; +AVHWAccel ff_hevc_mediacodec_hwaccel; +AVHWAccel ff_mpeg4_mediacodec_hwaccel; +AVHWAccel ff_vp8_mediacodec_hwaccel; +AVHWAccel ff_vp9_mediacodec_hwaccel; /* Added by FFmpeg 3.4 */ AVHWAccel ff_h264_d3d11va2_hwaccel; AVHWAccel ff_hevc_d3d11va2_hwaccel; AVHWAccel ff_hevc_videotoolbox_hwaccel; AVHWAccel ff_mpeg2_d3d11va2_hwaccel; +AVHWAccel ff_mpeg2_mediacodec_hwaccel; AVHWAccel ff_vc1_d3d11va2_hwaccel; +AVHWAccel ff_vp8_qsv_hwaccel; AVHWAccel ff_vp9_d3d11va2_hwaccel; AVHWAccel ff_wmv3_d3d11va2_hwaccel; @@ -158,6 +185,8 @@ AVCodec ff_h264_decoder; AVCodec ff_h264_crystalhd_decoder; AVCodec ff_h264_mmal_decoder; AVCodec ff_h264_qsv_decoder; +AVCodec ff_h264_vda_decoder; +AVCodec ff_h264_vdpau_decoder; AVCodec ff_hap_encoder; AVCodec ff_hap_decoder; AVCodec ff_hevc_decoder; @@ -192,6 +221,7 @@ AVCodec ff_mjpeg_decoder; AVCodec ff_mjpegb_decoder; AVCodec ff_mmvideo_decoder; AVCodec ff_motionpixels_decoder; +AVCodec ff_mpeg_xvmc_decoder; AVCodec ff_mpeg1video_encoder; AVCodec ff_mpeg1video_decoder; AVCodec ff_mpeg2video_encoder; @@ -200,7 +230,10 @@ AVCodec ff_mpeg4_encoder; AVCodec ff_mpeg4_decoder; AVCodec ff_mpeg4_crystalhd_decoder; AVCodec ff_mpeg4_mmal_decoder; +AVCodec ff_mpeg4_vdpau_decoder; AVCodec ff_mpegvideo_decoder; +AVCodec ff_mpeg_vdpau_decoder; +AVCodec ff_mpeg1_vdpau_decoder; AVCodec ff_mpeg2_crystalhd_decoder; AVCodec ff_mpeg2_qsv_decoder; AVCodec ff_msa1_decoder; @@ -311,6 +344,7 @@ AVCodec ff_vb_decoder; AVCodec ff_vble_decoder; AVCodec ff_vc1_decoder; AVCodec ff_vc1_crystalhd_decoder; +AVCodec ff_vc1_vdpau_decoder; AVCodec ff_vc1image_decoder; AVCodec ff_vc1_qsv_decoder; AVCodec ff_vc2_encoder; @@ -331,6 +365,7 @@ AVCodec ff_wmv2_encoder; AVCodec ff_wmv2_decoder; AVCodec ff_wmv3_decoder; AVCodec ff_wmv3_crystalhd_decoder; +AVCodec ff_wmv3_vdpau_decoder; AVCodec ff_wmv3image_decoder; AVCodec ff_wnv1_decoder; AVCodec ff_xan_wc3_decoder; @@ -705,8 +740,10 @@ AVCodec ff_vp8_mediacodec_decoder; AVCodec ff_mpeg4_mediacodec_decoder; AVCodec ff_mpeg4_cuvid_decoder; AVCodec ff_mpeg2_cuvid_decoder; +AVCodec ff_mpeg1_cuvid_decoder; AVCodec ff_mjpeg_cuvid_decoder; AVCodec ff_hevc_mediacodec_decoder; +AVCodec ff_h263_cuvid_decoder; AVCodec ff_libopenh264_decoder; AVCodec ff_pcm_s64le_decoder; AVCodec ff_pcm_s64le_encoder; @@ -763,7 +800,6 @@ AVCodec ff_vp8_v4l2m2m_encoder; AVCodec ff_vp8_vaapi_encoder; AVCodec ff_vp9_vaapi_encoder; - AVCodecParser ff_aac_parser; AVCodecParser ff_aac_latm_parser; AVCodecParser ff_ac3_parser; @@ -779,7 +815,6 @@ AVCodecParser ff_dvaudio_parser; AVCodecParser ff_dvbsub_parser; AVCodecParser ff_dvdsub_parser; AVCodecParser ff_dvd_nav_parser; -AVCodecParser ff_flac_parser; AVCodecParser ff_g729_parser; AVCodecParser ff_gsm_parser; AVCodecParser ff_h261_parser; @@ -819,11 +854,6 @@ AVBitStreamFilter ff_noise_bsf; AVBitStreamFilter ff_remove_extradata_bsf; AVBitStreamFilter ff_text2movsub_bsf; -void ff_fft_init_aarch64(FFTContext *s) {} -void ff_fft_init_arm(FFTContext *s) {} -void ff_fft_init_mips(FFTContext *s) {} -void ff_fft_init_ppc(FFTContext *s) {} -void ff_rdft_init_arm(RDFTContext *s) {} void ff_h264_pred_init_aarch64(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) {} @@ -847,9 +877,7 @@ void ff_vp8dsp_init_mips(VP8DSPContext *c) {} void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp) {} void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp, int bpp) {} void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp) {} -#if !defined(__arm__) void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps) {} -#endif #if !defined(HAVE_64BIT_BUILD) void ff_flac_decorrelate_indep8_16_sse2(uint8_t **out, int32_t **in, int channels, int len, int shift) {} void ff_flac_decorrelate_indep8_32_avx(uint8_t **out, int32_t **in, int channels, int len, int shift) {} diff --git a/media/ffvpx/libavcodec/error_resilience.h b/media/ffvpx/libavcodec/error_resilience.h index 664a76565..27c200869 100644 --- a/media/ffvpx/libavcodec/error_resilience.h +++ b/media/ffvpx/libavcodec/error_resilience.h @@ -20,7 +20,6 @@ #define AVCODEC_ERROR_RESILIENCE_H #include <stdint.h> -#include <stdatomic.h> #include "avcodec.h" #include "me_cmp.h" @@ -61,7 +60,7 @@ typedef struct ERContext { ptrdiff_t mb_stride; ptrdiff_t b8_stride; - atomic_int error_count; + volatile int error_count; int error_occurred; uint8_t *error_status_table; uint8_t *er_temp_buffer; diff --git a/media/ffvpx/libavcodec/flac_parser.c b/media/ffvpx/libavcodec/flac_parser.c index 272128646..84da23f32 100644 --- a/media/ffvpx/libavcodec/flac_parser.c +++ b/media/ffvpx/libavcodec/flac_parser.c @@ -686,17 +686,12 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, } for (curr = fpc->headers; curr; curr = curr->next) { - if (!fpc->best_header || curr->max_score > fpc->best_header->max_score) { + if (curr->max_score > 0 && + (!fpc->best_header || curr->max_score > fpc->best_header->max_score)) { fpc->best_header = curr; } } - if (fpc->best_header && fpc->best_header->max_score <= 0) { - // Only accept a bad header if there is no other option to continue - if (!buf_size || !buf || read_end != buf || fpc->nb_headers_buffered < FLAC_MIN_HEADERS) - fpc->best_header = NULL; - } - if (fpc->best_header) { fpc->best_header_valid = 1; if (fpc->best_header->offset > 0) { diff --git a/media/ffvpx/libavcodec/flacdec.c b/media/ffvpx/libavcodec/flacdec.c index c8eb45604..3d41a1af7 100644 --- a/media/ffvpx/libavcodec/flacdec.c +++ b/media/ffvpx/libavcodec/flacdec.c @@ -220,27 +220,20 @@ static int get_metadata_size(const uint8_t *buf, int buf_size) static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) { - GetBitContext gb = s->gb; int i, tmp, partition, method_type, rice_order; int rice_bits, rice_esc; int samples; - method_type = get_bits(&gb, 2); - rice_order = get_bits(&gb, 4); - - samples = s->blocksize >> rice_order; - rice_bits = 4 + method_type; - rice_esc = (1 << rice_bits) - 1; - - decoded += pred_order; - i = pred_order; - + method_type = get_bits(&s->gb, 2); if (method_type > 1) { av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n", method_type); return AVERROR_INVALIDDATA; } + rice_order = get_bits(&s->gb, 4); + + samples= s->blocksize >> rice_order; if (samples << rice_order != s->blocksize) { av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n", rice_order, s->blocksize); @@ -253,16 +246,21 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) return AVERROR_INVALIDDATA; } + rice_bits = 4 + method_type; + rice_esc = (1 << rice_bits) - 1; + + decoded += pred_order; + i= pred_order; for (partition = 0; partition < (1 << rice_order); partition++) { - tmp = get_bits(&gb, rice_bits); + tmp = get_bits(&s->gb, rice_bits); if (tmp == rice_esc) { - tmp = get_bits(&gb, 5); + tmp = get_bits(&s->gb, 5); for (; i < samples; i++) - *decoded++ = get_sbits_long(&gb, tmp); + *decoded++ = get_sbits_long(&s->gb, tmp); } else { int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX; for (; i < samples; i++) { - int v = get_sr_golomb_flac(&gb, tmp, real_limit, 0); + int v = get_sr_golomb_flac(&s->gb, tmp, real_limit, 0); if (v == 0x80000000){ av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n"); return AVERROR_INVALIDDATA; @@ -274,8 +272,6 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) i= 0; } - s->gb = gb; - return 0; } diff --git a/media/ffvpx/libavcodec/get_bits.h b/media/ffvpx/libavcodec/get_bits.h index 56ef5f0cb..0c7f5ff0c 100644 --- a/media/ffvpx/libavcodec/get_bits.h +++ b/media/ffvpx/libavcodec/get_bits.h @@ -32,7 +32,6 @@ #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/avassert.h" -#include "avcodec.h" #include "mathops.h" #include "vlc.h" @@ -202,13 +201,6 @@ static inline int get_bits_count(const GetBitContext *s) return s->index; } -/** - * Skips the specified number of bits. - * @param n the number of bits to skip, - * For the UNCHECKED_BITSTREAM_READER this must not cause the distance - * from the start to overflow int32_t. Staying within the bitstream + padding - * is sufficient, too. - */ static inline void skip_bits_long(GetBitContext *s, int n) { #if UNCHECKED_BITSTREAM_READER @@ -436,7 +428,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, int buffer_size; int ret = 0; - if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { + if (bit_size >= INT_MAX - 7 || bit_size < 0 || !buffer) { bit_size = 0; buffer = NULL; ret = AVERROR_INVALIDDATA; diff --git a/media/ffvpx/libavcodec/hwaccel.h b/media/ffvpx/libavcodec/hwaccel.h index 3aaa92571..124fbbf1f 100644 --- a/media/ffvpx/libavcodec/hwaccel.h +++ b/media/ffvpx/libavcodec/hwaccel.h @@ -19,66 +19,6 @@ #ifndef AVCODEC_HWACCEL_H #define AVCODEC_HWACCEL_H -#include "avcodec.h" -#include "hwaccels.h" - - #define HWACCEL_CAP_ASYNC_SAFE (1 << 0) - -typedef struct AVCodecHWConfigInternal { - /** - * This is the structure which will be returned to the user by - * avcodec_get_hw_config(). - */ - AVCodecHWConfig public; - /** - * If this configuration uses a hwaccel, a pointer to it. - * If not, NULL. - */ - const AVHWAccel *hwaccel; -} AVCodecHWConfigInternal; - - -// These macros are used to simplify AVCodecHWConfigInternal definitions. - -#define HW_CONFIG_HWACCEL(device, frames, ad_hoc, format, device_type_, name) \ - &(const AVCodecHWConfigInternal) { \ - .public = { \ - .pix_fmt = AV_PIX_FMT_ ## format, \ - .methods = (device ? AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX : 0) | \ - (frames ? AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX : 0) | \ - (ad_hoc ? AV_CODEC_HW_CONFIG_METHOD_AD_HOC : 0), \ - .device_type = AV_HWDEVICE_TYPE_ ## device_type_, \ - }, \ - .hwaccel = &name, \ - } - -#define HW_CONFIG_INTERNAL(format) \ - &(const AVCodecHWConfigInternal) { \ - .public = { \ - .pix_fmt = AV_PIX_FMT_ ## format, \ - .methods = AV_CODEC_HW_CONFIG_METHOD_INTERNAL, \ - .device_type = AV_HWDEVICE_TYPE_NONE, \ - }, \ - .hwaccel = NULL, \ - } - -#define HWACCEL_DXVA2(codec) \ - HW_CONFIG_HWACCEL(1, 1, 1, DXVA2_VLD, DXVA2, ff_ ## codec ## _dxva2_hwaccel) -#define HWACCEL_D3D11VA2(codec) \ - HW_CONFIG_HWACCEL(1, 1, 0, D3D11, D3D11VA, ff_ ## codec ## _d3d11va2_hwaccel) -#define HWACCEL_NVDEC(codec) \ - HW_CONFIG_HWACCEL(1, 1, 0, CUDA, CUDA, ff_ ## codec ## _nvdec_hwaccel) -#define HWACCEL_VAAPI(codec) \ - HW_CONFIG_HWACCEL(1, 1, 1, VAAPI, VAAPI, ff_ ## codec ## _vaapi_hwaccel) -#define HWACCEL_VDPAU(codec) \ - HW_CONFIG_HWACCEL(1, 1, 1, VDPAU, VDPAU, ff_ ## codec ## _vdpau_hwaccel) -#define HWACCEL_VIDEOTOOLBOX(codec) \ - HW_CONFIG_HWACCEL(1, 1, 1, VIDEOTOOLBOX, VIDEOTOOLBOX, ff_ ## codec ## _videotoolbox_hwaccel) -#define HWACCEL_D3D11VA(codec) \ - HW_CONFIG_HWACCEL(0, 0, 1, D3D11VA_VLD, NONE, ff_ ## codec ## _d3d11va_hwaccel) -#define HWACCEL_XVMC(codec) \ - HW_CONFIG_HWACCEL(0, 0, 1, XVMC, NONE, ff_ ## codec ## _xvmc_hwaccel) - #endif /* AVCODEC_HWACCEL_H */ diff --git a/media/ffvpx/libavcodec/hwaccels.h b/media/ffvpx/libavcodec/hwaccels.h deleted file mode 100644 index 7d73da867..000000000 --- a/media/ffvpx/libavcodec/hwaccels.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_HWACCELS_H -#define AVCODEC_HWACCELS_H - -#include "avcodec.h" - -extern const AVHWAccel ff_h263_vaapi_hwaccel; -extern const AVHWAccel ff_h263_videotoolbox_hwaccel; -extern const AVHWAccel ff_h264_d3d11va_hwaccel; -extern const AVHWAccel ff_h264_d3d11va2_hwaccel; -extern const AVHWAccel ff_h264_dxva2_hwaccel; -extern const AVHWAccel ff_h264_nvdec_hwaccel; -extern const AVHWAccel ff_h264_vaapi_hwaccel; -extern const AVHWAccel ff_h264_vdpau_hwaccel; -extern const AVHWAccel ff_h264_videotoolbox_hwaccel; -extern const AVHWAccel ff_hevc_d3d11va_hwaccel; -extern const AVHWAccel ff_hevc_d3d11va2_hwaccel; -extern const AVHWAccel ff_hevc_dxva2_hwaccel; -extern const AVHWAccel ff_hevc_nvdec_hwaccel; -extern const AVHWAccel ff_hevc_vaapi_hwaccel; -extern const AVHWAccel ff_hevc_vdpau_hwaccel; -extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; -extern const AVHWAccel ff_mjpeg_nvdec_hwaccel; -extern const AVHWAccel ff_mjpeg_vaapi_hwaccel; -extern const AVHWAccel ff_mpeg1_nvdec_hwaccel; -extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; -extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel; -extern const AVHWAccel ff_mpeg1_xvmc_hwaccel; -extern const AVHWAccel ff_mpeg2_d3d11va_hwaccel; -extern const AVHWAccel ff_mpeg2_d3d11va2_hwaccel; -extern const AVHWAccel ff_mpeg2_nvdec_hwaccel; -extern const AVHWAccel ff_mpeg2_dxva2_hwaccel; -extern const AVHWAccel ff_mpeg2_vaapi_hwaccel; -extern const AVHWAccel ff_mpeg2_vdpau_hwaccel; -extern const AVHWAccel ff_mpeg2_videotoolbox_hwaccel; -extern const AVHWAccel ff_mpeg2_xvmc_hwaccel; -extern const AVHWAccel ff_mpeg4_nvdec_hwaccel; -extern const AVHWAccel ff_mpeg4_vaapi_hwaccel; -extern const AVHWAccel ff_mpeg4_vdpau_hwaccel; -extern const AVHWAccel ff_mpeg4_videotoolbox_hwaccel; -extern const AVHWAccel ff_vc1_d3d11va_hwaccel; -extern const AVHWAccel ff_vc1_d3d11va2_hwaccel; -extern const AVHWAccel ff_vc1_dxva2_hwaccel; -extern const AVHWAccel ff_vc1_nvdec_hwaccel; -extern const AVHWAccel ff_vc1_vaapi_hwaccel; -extern const AVHWAccel ff_vc1_vdpau_hwaccel; -extern const AVHWAccel ff_vp8_nvdec_hwaccel; -extern const AVHWAccel ff_vp8_vaapi_hwaccel; -extern const AVHWAccel ff_vp9_d3d11va_hwaccel; -extern const AVHWAccel ff_vp9_d3d11va2_hwaccel; -extern const AVHWAccel ff_vp9_dxva2_hwaccel; -extern const AVHWAccel ff_vp9_nvdec_hwaccel; -extern const AVHWAccel ff_vp9_vaapi_hwaccel; -extern const AVHWAccel ff_wmv3_d3d11va_hwaccel; -extern const AVHWAccel ff_wmv3_d3d11va2_hwaccel; -extern const AVHWAccel ff_wmv3_dxva2_hwaccel; -extern const AVHWAccel ff_wmv3_nvdec_hwaccel; -extern const AVHWAccel ff_wmv3_vaapi_hwaccel; -extern const AVHWAccel ff_wmv3_vdpau_hwaccel; - -#endif /* AVCODEC_HWACCELS_H */ diff --git a/media/ffvpx/libavcodec/idctdsp.h b/media/ffvpx/libavcodec/idctdsp.h index ca21a31a0..26221f6a9 100644 --- a/media/ffvpx/libavcodec/idctdsp.h +++ b/media/ffvpx/libavcodec/idctdsp.h @@ -95,8 +95,6 @@ typedef struct IDCTDSPContext { */ uint8_t idct_permutation[64]; enum idct_permutation_type perm_type; - - int mpeg4_studio_profile; } IDCTDSPContext; void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, diff --git a/media/ffvpx/libavcodec/imgconvert.c b/media/ffvpx/libavcodec/imgconvert.c index 1fd636c83..1547f1896 100644 --- a/media/ffvpx/libavcodec/imgconvert.c +++ b/media/ffvpx/libavcodec/imgconvert.c @@ -69,15 +69,10 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p int i; enum AVPixelFormat best = AV_PIX_FMT_NONE; - int loss; - for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) { - loss = loss_ptr ? *loss_ptr : 0; - best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss); - } + for(i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) + best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); - if (loss_ptr) - *loss_ptr = loss; return best; } diff --git a/media/ffvpx/libavcodec/internal.h b/media/ffvpx/libavcodec/internal.h index bb92873d7..faa923c11 100644 --- a/media/ffvpx/libavcodec/internal.h +++ b/media/ffvpx/libavcodec/internal.h @@ -76,20 +76,22 @@ #endif +#if !FF_API_QUANT_BIAS #define FF_DEFAULT_QUANT_BIAS 999999 +#endif +#if !FF_API_QSCALE_TYPE #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 #define FF_QSCALE_TYPE_H264 2 #define FF_QSCALE_TYPE_VP56 3 +#endif #define FF_SANE_NB_CHANNELS 64U #define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1) -#if HAVE_SIMD_ALIGN_64 -# define STRIDE_ALIGN 64 /* AVX-512 */ -#elif HAVE_SIMD_ALIGN_32 +#if HAVE_SIMD_ALIGN_32 # define STRIDE_ALIGN 32 #elif HAVE_SIMD_ALIGN_16 # define STRIDE_ALIGN 16 @@ -235,8 +237,21 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); unsigned int avpriv_toupper4(unsigned int x); +/** + * does needed setup of pkt_pts/pos and such for (re)get_buffer(); + */ +int ff_init_buffer_info(AVCodecContext *s, AVFrame *frame); + + void ff_color_frame(AVFrame *frame, const int color[4]); +extern volatile int ff_avcodec_locked; +int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec); +int ff_unlock_avcodec(const AVCodec *codec); + +int avpriv_lock_avformat(void); +int avpriv_unlock_avformat(void); + /** * Maximum size in bytes of extradata. * This value was chosen such that every bit of the buffer is @@ -358,16 +373,14 @@ int ff_set_sar(AVCodecContext *avctx, AVRational sar); int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding); +#if FF_API_MERGE_SD +int ff_packet_split_and_drop_side_data(AVPacket *pkt); +#endif + /** * Select the (possibly hardware accelerated) pixel format. * This is a wrapper around AVCodecContext.get_format() and should be used * instead of calling get_format() directly. - * - * The list of pixel formats must contain at least one valid entry, and is - * terminated with AV_PIX_FMT_NONE. If it is possible to decode to software, - * the last entry in the list must be the most accurate software format. - * If it is not possible to decode to software, AVCodecContext.sw_pix_fmt - * must be set before calling this function. */ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt); @@ -404,10 +417,4 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, */ int64_t ff_guess_coded_bitrate(AVCodecContext *avctx); -#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) -# define av_export_avcodec __declspec(dllimport) -#else -# define av_export_avcodec -#endif - #endif /* AVCODEC_INTERNAL_H */ diff --git a/media/ffvpx/libavcodec/me_cmp.h b/media/ffvpx/libavcodec/me_cmp.h index 0a589e3c3..0dbbcbb1d 100644 --- a/media/ffvpx/libavcodec/me_cmp.h +++ b/media/ffvpx/libavcodec/me_cmp.h @@ -23,7 +23,7 @@ #include "avcodec.h" -extern const uint32_t ff_square_tab[512]; +extern uint32_t ff_square_tab[512]; /* minimum alignment rules ;) @@ -79,6 +79,8 @@ typedef struct MECmpContext { me_cmp_func median_sad[6]; } MECmpContext; +void ff_me_cmp_init_static(void); + int ff_check_alignment(void); void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx); diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build index 05217a6e4..9980e1556 100644 --- a/media/ffvpx/libavcodec/moz.build +++ b/media/ffvpx/libavcodec/moz.build @@ -12,6 +12,7 @@ if CONFIG['FFVPX_ASFLAGS']: SharedLibrary('mozavcodec') SOURCES += [ 'allcodecs.c', + 'audioconvert.c', 'avpacket.c', 'avpicture.c', 'bitstream.c', @@ -40,6 +41,8 @@ SOURCES += [ 'pthread_slice.c', 'qsv_api.c', 'raw.c', + 'resample.c', + 'resample2.c', 'reverse.c', 'utils.c', 'videodsp.c', @@ -50,7 +53,6 @@ SOURCES += [ 'vp8dsp.c', 'vp9.c', 'vp9_parser.c', - 'vp9_superframe_split_bsf.c', 'vp9block.c', 'vp9data.c', 'vp9dsp.c', diff --git a/media/ffvpx/libavcodec/mpegutils.h b/media/ffvpx/libavcodec/mpegutils.h index 1ed21c19b..9cfadfc4c 100644 --- a/media/ffvpx/libavcodec/mpegutils.h +++ b/media/ffvpx/libavcodec/mpegutils.h @@ -48,6 +48,7 @@ #define MAX_FCODE 7 /* MB types */ +#if !FF_API_MB_TYPE #define MB_TYPE_INTRA4x4 (1 << 0) #define MB_TYPE_INTRA16x16 (1 << 1) // FIXME H.264-specific #define MB_TYPE_INTRA_PCM (1 << 2) // FIXME H.264-specific @@ -69,6 +70,7 @@ #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) #define MB_TYPE_QUANT (1 << 16) #define MB_TYPE_CBP (1 << 17) +#endif #define MB_TYPE_INTRA MB_TYPE_INTRA4x4 // default mb_type if there is just one type @@ -137,12 +139,4 @@ void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay); -/** - * Print debugging info for the given picture. - */ -void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, - uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2], - int *low_delay, - int mb_width, int mb_height, int mb_stride, int quarter_sample); - #endif /* AVCODEC_MPEGUTILS_H */ diff --git a/media/ffvpx/libavcodec/mpegvideo.h b/media/ffvpx/libavcodec/mpegvideo.h index 541909cbb..e9eb633d1 100644 --- a/media/ffvpx/libavcodec/mpegvideo.h +++ b/media/ffvpx/libavcodec/mpegvideo.h @@ -45,7 +45,6 @@ #include "mpegpicture.h" #include "mpegvideodsp.h" #include "mpegvideoencdsp.h" -#include "mpegvideodata.h" #include "pixblockdsp.h" #include "put_bits.h" #include "ratecontrol.h" @@ -72,8 +71,6 @@ #define SLICE_MAX_START_CODE 0x000001af #define EXT_START_CODE 0x000001b5 #define USER_START_CODE 0x000001b2 -#define SLICE_START_CODE 0x000001b7 - /** * MpegEncContext. @@ -255,6 +252,9 @@ typedef struct MpegEncContext { int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced B-frame encoding uint8_t (*p_field_select_table[2]); uint8_t (*b_field_select_table[2][2]); +#if FF_API_MOTION_EST + int me_method; ///< ME algorithm +#endif int motion_est; ///< ME algorithm int me_penalty_compensation; int me_pre; ///< prepass for motion estimation @@ -381,8 +381,6 @@ typedef struct MpegEncContext { int custom_pcf; /* MPEG-4 specific */ - int studio_profile; - int dct_precision; ///< number of bits to represent the fractional part of time (encoder only) int time_increment_bits; int last_time_base; @@ -469,13 +467,6 @@ typedef struct MpegEncContext { int intra_vlc_format; int alternate_scan; int seq_disp_ext; - int video_format; -#define VIDEO_FORMAT_COMPONENT 0 -#define VIDEO_FORMAT_PAL 1 -#define VIDEO_FORMAT_NTSC 2 -#define VIDEO_FORMAT_SECAM 3 -#define VIDEO_FORMAT_MAC 4 -#define VIDEO_FORMAT_UNSPECIFIED 5 int repeat_first_field; int chroma_420_type; int chroma_format; @@ -506,10 +497,7 @@ typedef struct MpegEncContext { int16_t (*block)[64]; ///< points to one of the following blocks int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block - int (*decode_mb)(struct MpegEncContext *s, int16_t block[12][64]); // used by some codecs to avoid a switch() - - int32_t (*block32)[12][64]; - + int (*decode_mb)(struct MpegEncContext *s, int16_t block[6][64]); // used by some codecs to avoid a switch() #define SLICE_OK 0 #define SLICE_ERROR -1 #define SLICE_END -2 ///<end marker found @@ -711,6 +699,10 @@ void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); void ff_mpeg_flush(AVCodecContext *avctx); void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict); +void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, + uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2], + int *low_delay, + int mb_width, int mb_height, int mb_stride, int quarter_sample); int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type); @@ -737,8 +729,7 @@ void ff_mpv_motion(MpegEncContext *s, qpel_mc_func (*qpix_op)[16]); static inline void ff_update_block_index(MpegEncContext *s){ - const int bytes_per_pixel = 1 + (s->avctx->bits_per_raw_sample > 8); - const int block_size= (8*bytes_per_pixel) >> s->avctx->lowres; + const int block_size= 8 >> s->avctx->lowres; s->block_index[0]+=2; s->block_index[1]+=2; @@ -747,8 +738,8 @@ static inline void ff_update_block_index(MpegEncContext *s){ s->block_index[4]++; s->block_index[5]++; s->dest[0]+= 2*block_size; - s->dest[1]+= (2 >> s->chroma_x_shift) * block_size; - s->dest[2]+= (2 >> s->chroma_x_shift) * block_size; + s->dest[1]+= block_size; + s->dest[2]+= block_size; } static inline int get_bits_diff(MpegEncContext *s){ @@ -760,13 +751,4 @@ static inline int get_bits_diff(MpegEncContext *s){ return bits - last; } -static inline int mpeg_get_qscale(MpegEncContext *s) -{ - int qscale = get_bits(&s->gb, 5); - if (s->q_scale_type) - return ff_mpeg2_non_linear_qscale[qscale]; - else - return qscale << 1; -} - #endif /* AVCODEC_MPEGVIDEO_H */ diff --git a/media/ffvpx/libavcodec/mpegvideodata.h b/media/ffvpx/libavcodec/mpegvideodata.h deleted file mode 100644 index 14f4806d6..000000000 --- a/media/ffvpx/libavcodec/mpegvideodata.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MPEGVIDEODATA_H -#define AVCODEC_MPEGVIDEODATA_H - -#include <stdint.h> - -/* encoding scans */ -extern const uint8_t ff_alternate_horizontal_scan[64]; -extern const uint8_t ff_alternate_vertical_scan[64]; - -extern const uint8_t ff_mpeg1_dc_scale_table[128]; -extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; - -extern const uint8_t ff_mpeg2_non_linear_qscale[32]; - -extern const uint8_t ff_default_chroma_qscale_table[32]; - -#endif /* AVCODEC_MPEGVIDEODATA_H */ diff --git a/media/ffvpx/libavcodec/null_bsf.c b/media/ffvpx/libavcodec/null_bsf.c index 24d26dfb1..feb71248a 100644 --- a/media/ffvpx/libavcodec/null_bsf.c +++ b/media/ffvpx/libavcodec/null_bsf.c @@ -24,9 +24,17 @@ #include "avcodec.h" #include "bsf.h" -static int null_filter(AVBSFContext *ctx, AVPacket *pkt) +static int null_filter(AVBSFContext *ctx, AVPacket *out) { - return ff_bsf_get_packet_ref(ctx, pkt); + AVPacket *in; + int ret; + + ret = ff_bsf_get_packet(ctx, &in); + if (ret < 0) + return ret; + av_packet_move_ref(out, in); + av_packet_free(&in); + return 0; } const AVBitStreamFilter ff_null_bsf = { diff --git a/media/ffvpx/libavcodec/options.c b/media/ffvpx/libavcodec/options.c index 41b60521c..82e12179a 100644 --- a/media/ffvpx/libavcodec/options.c +++ b/media/ffvpx/libavcodec/options.c @@ -30,6 +30,7 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/opt.h" +#include <float.h> /* FLT_MIN, FLT_MAX */ #include <string.h> FF_DISABLE_DEPRECATION_WARNINGS diff --git a/media/ffvpx/libavcodec/options_table.h b/media/ffvpx/libavcodec/options_table.h index 099261e16..2ac37c3ff 100644 --- a/media/ffvpx/libavcodec/options_table.h +++ b/media/ffvpx/libavcodec/options_table.h @@ -54,11 +54,26 @@ static const AVOption avcodec_options[] = { {"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, {"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, {"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, +#if FF_API_GMC +{"gmc", "use gmc", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"}, +#endif +#if FF_API_MV0 +{"mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"}, +#endif +#if FF_API_INPUT_PRESERVED +{"input_preserved", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"}, +#endif {"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"}, {"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, +#if FF_API_EMU_EDGE +{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, +#endif {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, {"truncated", "Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D, "flags"}, +#if FF_API_NORMALIZE_AQP +{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, +#endif {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, @@ -76,6 +91,21 @@ static const AVOption avcodec_options[] = { {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"}, {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"}, {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"}, +#if FF_API_MOTION_EST +{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"}, +{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"epzs", "EPZS motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"esa", "esa motion estimation (alias for full)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"tesa", "tesa motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"dia", "diamond motion estimation (alias for EPZS)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"log", "log motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"phods", "phods motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" }, +#endif {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX}, {"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E}, {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E}, @@ -93,6 +123,9 @@ static const AVOption avcodec_options[] = { {"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E}, {"bf", "set maximum number of B-frames between non-B-frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, INT_MAX, V|E}, {"b_qfactor", "QP factor between P- and B-frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, +#if FF_API_RC_STRATEGY +{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#endif #if FF_API_PRIVATE_OPT {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E}, {"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, @@ -111,10 +144,16 @@ static const AVOption avcodec_options[] = { {"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, {"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, +#if FF_API_OLD_MSMPEG4 +{"old_msmpeg4", "some old lavc-generated MSMPEG4v3 files (no autodetection)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, "bug"}, +#endif {"xvid_ilace", "Xvid interlacing bug (autodetected if FOURCC == XVIX)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"}, {"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"}, {"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"}, {"amv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"}, +#if FF_API_AC_VLC +{"ac_vlc", "illegal VLC bug (autodetected per FOURCC)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"}, +#endif {"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, {"std_qpel", "old standard qpel (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"}, {"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, "bug"}, @@ -146,13 +185,27 @@ static const AVOption avcodec_options[] = { #if FF_API_PRIVATE_OPT {"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif +#if FF_API_MPV_OPT +{"qsquish", "deprecated, use encoder private options instead", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E}, +{"rc_qmod_amp", "deprecated, use encoder private options instead", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +{"rc_qmod_freq", "deprecated, use encoder private options instead", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#endif {"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#if FF_API_MPV_OPT +{"rc_eq", "deprecated, use encoder private options instead", OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E}, +#endif {"maxrate", "maximum bitrate (in bits/s). Used for VBV together with bufsize.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT_MAX, V|A|E}, {"minrate", "minimum bitrate (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.", OFFSET(rc_min_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, {"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|E}, +#if FF_API_MPV_OPT +{"rc_buf_aggressivity", "deprecated, use encoder private options instead", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E}, +#endif {"i_qfactor", "QP factor between P- and I-frames", OFFSET(i_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E}, {"i_qoffset", "QP offset between P- and I-frames", OFFSET(i_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 0.0 }, -FLT_MAX, FLT_MAX, V|E}, +#if FF_API_MPV_OPT +{"rc_init_cplx", "deprecated, use encoder private options instead", OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +#endif {"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"}, {"auto", "autoselect a good one", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"}, {"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, @@ -172,10 +225,19 @@ static const AVOption avcodec_options[] = { {"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"arm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#if FF_API_ARCH_SH4 +{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#endif {"simplearm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simplearmv5te", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simplearmv6", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simpleneon", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#if FF_API_ARCH_ALPHA +{"simplealpha", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#endif +#if FF_API_UNUSED_MEMBERS +{"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#endif /* FF_API_UNUSED_MEMBERS */ {"xvid", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"xvidmmx", "deprecated, for compatibility only", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, @@ -207,6 +269,9 @@ static const AVOption avcodec_options[] = { {"green_metadata", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_GREEN_MD }, INT_MIN, INT_MAX, V|D, "debug"}, {"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"}, {"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"}, +#if FF_API_UNUSED_MEMBERS +{"pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"}, +#endif /* FF_API_UNUSED_MEMBERS */ {"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"}, {"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"}, {"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"}, @@ -217,6 +282,12 @@ static const AVOption avcodec_options[] = { {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"}, {"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"}, +#if FF_API_VISMV +{"vismv", "visualize motion vectors (MVs) (deprecated)", OFFSET(debug_mv), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"}, +{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +#endif {"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, @@ -247,7 +318,14 @@ static const AVOption avcodec_options[] = { {"msad", "sum of absolute differences, median predicted", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_MEDIAN_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, +#if FF_API_AFD +{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#endif {"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#if FF_API_QUANT_BIAS +{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, +{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, +#endif {"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, #if FF_API_CODER_TYPE {"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"}, @@ -255,25 +333,45 @@ static const AVOption avcodec_options[] = { {"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"}, {"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"}, {"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"}, +#if FF_API_UNUSED_MEMBERS +{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"}, +#endif /* FF_API_UNUSED_MEMBERS */ #endif /* FF_API_CODER_TYPE */ #if FF_API_PRIVATE_OPT {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif {"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#if FF_API_XVMC +{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#endif /* FF_API_XVMC */ {"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 2, V|E, "mbd"}, {"simple", "use mbcmp", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"}, {"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"}, {"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"}, +#if FF_API_STREAM_CODEC_TAG +{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, +#endif #if FF_API_PRIVATE_OPT {"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif +#if FF_API_MPV_OPT +{"lmin", "deprecated, use encoder private options instead", OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E}, +{"lmax", "deprecated, use encoder private options instead", OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E}, +#endif #if FF_API_PRIVATE_OPT {"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"}, +#if FF_API_ERROR_RATE +{"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#endif {"threads", "set the number of threads", OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, "threads"}, {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"}, +#if FF_API_MPV_OPT +{"me_threshold", "motion estimation threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, +#endif {"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, -8, 16, V|E}, {"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, {"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D}, @@ -300,7 +398,6 @@ static const AVOption avcodec_options[] = { {"mpeg4_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_MAIN }, INT_MIN, INT_MAX, V|E, "profile"}, {"mpeg4_asp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_ADVANCED_SIMPLE }, INT_MIN, INT_MAX, V|E, "profile"}, {"main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "profile"}, -{"msbc", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_SBC_MSBC }, INT_MIN, INT_MAX, A|E, "profile"}, {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D}, @@ -310,6 +407,9 @@ static const AVOption avcodec_options[] = { {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, #endif +#if FF_API_MPV_OPT +{"border_mask", "deprecated, use encoder private options instead", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +#endif {"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, {"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E}, #if FF_API_PRIVATE_OPT @@ -335,6 +435,9 @@ static const AVOption avcodec_options[] = { {"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, +#if FF_API_UNUSED_MEMBERS +{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E}, +#endif /* FF_API_UNUSED_MEMBERS */ {"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.i64 = 256 }, 0, INT_MAX, V|E}, #if FF_API_PRIVATE_OPT {"b_sensitivity", "adjust sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.i64 = 40 }, 1, INT_MAX, V|E}, @@ -447,7 +550,6 @@ static const AVOption avcodec_options[] = { {"do_nothing", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_DO_NOTHING}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, -{"ignore", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_IGNORE}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, #if FF_API_ASS_TIMING {"sub_text_format", "set decoded text subtitle format", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS}, 0, 1, S|D, "sub_text_format"}, #else @@ -478,7 +580,6 @@ static const AVOption avcodec_options[] = { {"ignore_level", "ignore level even if the codec level used is unknown or higher than the maximum supported level reported by the hardware driver", 0, AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V | D, "hwaccel_flags" }, {"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"}, -{"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D }, {NULL}, }; diff --git a/media/ffvpx/libavcodec/parser.c b/media/ffvpx/libavcodec/parser.c index f43b197d5..670680ea7 100644 --- a/media/ffvpx/libavcodec/parser.c +++ b/media/ffvpx/libavcodec/parser.c @@ -25,108 +25,40 @@ #include <string.h> #include "libavutil/avassert.h" +#include "libavutil/atomic.h" #include "libavutil/internal.h" #include "libavutil/mem.h" -#include "libavutil/thread.h" #include "internal.h" #include "parser.h" -/* Parsers */ -extern AVCodecParser ff_aac_parser; -extern AVCodecParser ff_aac_latm_parser; -extern AVCodecParser ff_ac3_parser; -extern AVCodecParser ff_adx_parser; -extern AVCodecParser ff_bmp_parser; -extern AVCodecParser ff_cavsvideo_parser; -extern AVCodecParser ff_cook_parser; -extern AVCodecParser ff_dca_parser; -extern AVCodecParser ff_dirac_parser; -extern AVCodecParser ff_dnxhd_parser; -extern AVCodecParser ff_dpx_parser; -extern AVCodecParser ff_dvaudio_parser; -extern AVCodecParser ff_dvbsub_parser; -extern AVCodecParser ff_dvdsub_parser; -extern AVCodecParser ff_dvd_nav_parser; -extern AVCodecParser ff_flac_parser; -extern AVCodecParser ff_g729_parser; -extern AVCodecParser ff_gsm_parser; -extern AVCodecParser ff_h261_parser; -extern AVCodecParser ff_h263_parser; -extern AVCodecParser ff_h264_parser; -extern AVCodecParser ff_hevc_parser; -extern AVCodecParser ff_mjpeg_parser; -extern AVCodecParser ff_mlp_parser; -extern AVCodecParser ff_mpeg4video_parser; -extern AVCodecParser ff_mpegaudio_parser; -extern AVCodecParser ff_mpegvideo_parser; -extern AVCodecParser ff_opus_parser; -extern AVCodecParser ff_png_parser; -extern AVCodecParser ff_pnm_parser; -extern AVCodecParser ff_rv30_parser; -extern AVCodecParser ff_rv40_parser; -extern AVCodecParser ff_sbc_parser; -extern AVCodecParser ff_sipr_parser; -extern AVCodecParser ff_tak_parser; -extern AVCodecParser ff_vc1_parser; -extern AVCodecParser ff_vorbis_parser; -extern AVCodecParser ff_vp3_parser; -extern AVCodecParser ff_vp8_parser; -extern AVCodecParser ff_vp9_parser; -extern AVCodecParser ff_xma_parser; - -#include "libavcodec/parser_list.c" - -static AVOnce av_parser_next_init = AV_ONCE_INIT; - -static void av_parser_init_next(void) -{ - AVCodecParser *prev = NULL, *p; - int i = 0; - while ((p = (AVCodecParser*)parser_list[i++])) { - if (prev) - prev->next = p; - prev = p; - } -} +static AVCodecParser *av_first_parser = NULL; AVCodecParser *av_parser_next(const AVCodecParser *p) { - ff_thread_once(&av_parser_next_init, av_parser_init_next); - if (p) return p->next; else - return (AVCodecParser*)parser_list[0]; -} - -const AVCodecParser *av_parser_iterate(void **opaque) -{ - uintptr_t i = (uintptr_t)*opaque; - const AVCodecParser *p = parser_list[i]; - - if (p) - *opaque = (void*)(i + 1); - - return p; + return av_first_parser; } void av_register_codec_parser(AVCodecParser *parser) { - ff_thread_once(&av_parser_next_init, av_parser_init_next); + do { + parser->next = av_first_parser; + } while (parser->next != avpriv_atomic_ptr_cas((void * volatile *)&av_first_parser, parser->next, parser)); } AVCodecParserContext *av_parser_init(int codec_id) { AVCodecParserContext *s = NULL; - const AVCodecParser *parser; - void *i = 0; + AVCodecParser *parser; int ret; if (codec_id == AV_CODEC_ID_NONE) return NULL; - while ((parser = av_parser_iterate(&i))) { + for (parser = av_first_parser; parser; parser = parser->next) { if (parser->codec_ids[0] == codec_id || parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || @@ -140,7 +72,7 @@ found: s = av_mallocz(sizeof(AVCodecParserContext)); if (!s) goto err_out; - s->parser = (AVCodecParser*)parser; + s->parser = parser; s->priv_data = av_mallocz(parser->priv_data_size); if (!s->priv_data) goto err_out; diff --git a/media/ffvpx/libavcodec/parser_list.c b/media/ffvpx/libavcodec/parser_list.c deleted file mode 100644 index b60c60bce..000000000 --- a/media/ffvpx/libavcodec/parser_list.c +++ /dev/null @@ -1,8 +0,0 @@ -static const AVCodecParser * const parser_list[] = { -#if CONFIG_VP8_PARSER - &ff_vp8_parser, -#endif -#if CONFIG_VP9_PARSER - &ff_vp9_parser, -#endif - NULL }; diff --git a/media/ffvpx/libavcodec/profiles.c b/media/ffvpx/libavcodec/profiles.c index d7dc960f3..30498efed 100644 --- a/media/ffvpx/libavcodec/profiles.c +++ b/media/ffvpx/libavcodec/profiles.c @@ -140,16 +140,4 @@ const AVProfile ff_vp9_profiles[] = { { FF_PROFILE_UNKNOWN }, }; -const AVProfile ff_av1_profiles[] = { - { FF_PROFILE_AV1_MAIN, "Main" }, - { FF_PROFILE_AV1_HIGH, "High" }, - { FF_PROFILE_AV1_PROFESSIONAL, "Professional" }, - { FF_PROFILE_UNKNOWN }, -}; - -const AVProfile ff_sbc_profiles[] = { - { FF_PROFILE_SBC_MSBC, "mSBC" }, - { FF_PROFILE_UNKNOWN }, -}; - #endif /* !CONFIG_SMALL */ diff --git a/media/ffvpx/libavcodec/profiles.h b/media/ffvpx/libavcodec/profiles.h index 9d7e211e1..eb18b406a 100644 --- a/media/ffvpx/libavcodec/profiles.h +++ b/media/ffvpx/libavcodec/profiles.h @@ -31,7 +31,5 @@ extern const AVProfile ff_mpeg2_video_profiles[]; extern const AVProfile ff_mpeg4_video_profiles[]; extern const AVProfile ff_vc1_profiles[]; extern const AVProfile ff_vp9_profiles[]; -extern const AVProfile ff_av1_profiles[]; -extern const AVProfile ff_sbc_profiles[]; #endif /* AVCODEC_PROFILES_H */ diff --git a/media/ffvpx/libavcodec/pthread_frame.c b/media/ffvpx/libavcodec/pthread_frame.c index 5104b1beb..2c702c737 100644 --- a/media/ffvpx/libavcodec/pthread_frame.c +++ b/media/ffvpx/libavcodec/pthread_frame.c @@ -246,7 +246,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, { int err = 0; - if (dst != src && (for_user || !(src->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY))) { + if (dst != src && (for_user || !(av_codec_get_codec_descriptor(src)->props & AV_CODEC_PROP_INTRA_ONLY))) { dst->time_base = src->time_base; dst->framerate = src->framerate; dst->width = src->width; @@ -262,6 +262,11 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, dst->bits_per_coded_sample = src->bits_per_coded_sample; dst->sample_aspect_ratio = src->sample_aspect_ratio; +#if FF_API_AFD +FF_DISABLE_DEPRECATION_WARNINGS + dst->dtg_active_format = src->dtg_active_format; +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* FF_API_AFD */ dst->profile = src->profile; dst->level = src->level; @@ -728,6 +733,10 @@ int ff_frame_thread_init(AVCodecContext *avctx) FrameThreadContext *fctx; int i, err = 0; +#if HAVE_W32THREADS + w32thread_init(); +#endif + if (!thread_count) { int nb_cpus = av_cpu_count(); #if FF_API_DEBUG_MV @@ -886,6 +895,8 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int f->owner[0] = f->owner[1] = avctx; + ff_init_buffer_info(avctx, f->f); + if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); diff --git a/media/ffvpx/libavcodec/pthread_slice.c b/media/ffvpx/libavcodec/pthread_slice.c index 77cfe3c9f..d659f9b0b 100644 --- a/media/ffvpx/libavcodec/pthread_slice.c +++ b/media/ffvpx/libavcodec/pthread_slice.c @@ -132,6 +132,10 @@ int ff_slice_thread_init(AVCodecContext *avctx) int thread_count = avctx->thread_count; static void (*mainfunc)(void *); +#if HAVE_W32THREADS + w32thread_init(); +#endif + // We cannot do this in the encoder init as the threads are created before if (av_codec_is_encoder(avctx->codec) && avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && diff --git a/media/ffvpx/libavcodec/raw.h b/media/ffvpx/libavcodec/raw.h index 28a27b1f9..24bf4cc55 100644 --- a/media/ffvpx/libavcodec/raw.h +++ b/media/ffvpx/libavcodec/raw.h @@ -28,7 +28,6 @@ #define AVCODEC_RAW_H #include "avcodec.h" -#include "internal.h" #include "libavutil/internal.h" typedef struct PixelFormatTag { @@ -42,7 +41,7 @@ const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void); enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc); -extern av_export_avcodec const PixelFormatTag avpriv_pix_fmt_bps_avi[]; -extern av_export_avcodec const PixelFormatTag avpriv_pix_fmt_bps_mov[]; +extern av_export const PixelFormatTag avpriv_pix_fmt_bps_avi[]; +extern av_export const PixelFormatTag avpriv_pix_fmt_bps_mov[]; #endif /* AVCODEC_RAW_H */ diff --git a/media/ffvpx/libavcodec/resample.c b/media/ffvpx/libavcodec/resample.c new file mode 100644 index 000000000..4c5eb9f10 --- /dev/null +++ b/media/ffvpx/libavcodec/resample.c @@ -0,0 +1,439 @@ +/* + * samplerate conversion for both audio and video + * Copyright (c) 2000 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * samplerate conversion for both audio and video + */ + +#include <string.h> + +#include "avcodec.h" +#include "audioconvert.h" +#include "libavutil/opt.h" +#include "libavutil/mem.h" +#include "libavutil/samplefmt.h" + +#if FF_API_AVCODEC_RESAMPLE +FF_DISABLE_DEPRECATION_WARNINGS + +#define MAX_CHANNELS 8 + +struct AVResampleContext; + +static const char *context_to_name(void *ptr) +{ + return "audioresample"; +} + +static const AVOption options[] = {{NULL}}; +static const AVClass audioresample_context_class = { + "ReSampleContext", context_to_name, options, LIBAVUTIL_VERSION_INT +}; + +struct ReSampleContext { + struct AVResampleContext *resample_context; + short *temp[MAX_CHANNELS]; + int temp_len; + float ratio; + /* channel convert */ + int input_channels, output_channels, filter_channels; + AVAudioConvert *convert_ctx[2]; + enum AVSampleFormat sample_fmt[2]; ///< input and output sample format + unsigned sample_size[2]; ///< size of one sample in sample_fmt + short *buffer[2]; ///< buffers used for conversion to S16 + unsigned buffer_size[2]; ///< sizes of allocated buffers +}; + +/* n1: number of samples */ +static void stereo_to_mono(short *output, short *input, int n1) +{ + short *p, *q; + int n = n1; + + p = input; + q = output; + while (n >= 4) { + q[0] = (p[0] + p[1]) >> 1; + q[1] = (p[2] + p[3]) >> 1; + q[2] = (p[4] + p[5]) >> 1; + q[3] = (p[6] + p[7]) >> 1; + q += 4; + p += 8; + n -= 4; + } + while (n > 0) { + q[0] = (p[0] + p[1]) >> 1; + q++; + p += 2; + n--; + } +} + +/* n1: number of samples */ +static void mono_to_stereo(short *output, short *input, int n1) +{ + short *p, *q; + int n = n1; + int v; + + p = input; + q = output; + while (n >= 4) { + v = p[0]; q[0] = v; q[1] = v; + v = p[1]; q[2] = v; q[3] = v; + v = p[2]; q[4] = v; q[5] = v; + v = p[3]; q[6] = v; q[7] = v; + q += 8; + p += 4; + n -= 4; + } + while (n > 0) { + v = p[0]; q[0] = v; q[1] = v; + q += 2; + p += 1; + n--; + } +} + +/* +5.1 to stereo input: [fl, fr, c, lfe, rl, rr] +- Left = front_left + rear_gain * rear_left + center_gain * center +- Right = front_right + rear_gain * rear_right + center_gain * center +Where rear_gain is usually around 0.5-1.0 and + center_gain is almost always 0.7 (-3 dB) +*/ +static void surround_to_stereo(short **output, short *input, int channels, int samples) +{ + int i; + short l, r; + + for (i = 0; i < samples; i++) { + int fl,fr,c,rl,rr; + fl = input[0]; + fr = input[1]; + c = input[2]; + // lfe = input[3]; + rl = input[4]; + rr = input[5]; + + l = av_clip_int16(fl + (0.5 * rl) + (0.7 * c)); + r = av_clip_int16(fr + (0.5 * rr) + (0.7 * c)); + + /* output l & r. */ + *output[0]++ = l; + *output[1]++ = r; + + /* increment input. */ + input += channels; + } +} + +static void deinterleave(short **output, short *input, int channels, int samples) +{ + int i, j; + + for (i = 0; i < samples; i++) { + for (j = 0; j < channels; j++) { + *output[j]++ = *input++; + } + } +} + +static void interleave(short *output, short **input, int channels, int samples) +{ + int i, j; + + for (i = 0; i < samples; i++) { + for (j = 0; j < channels; j++) { + *output++ = *input[j]++; + } + } +} + +static void ac3_5p1_mux(short *output, short *input1, short *input2, int n) +{ + int i; + short l, r; + + for (i = 0; i < n; i++) { + l = *input1++; + r = *input2++; + *output++ = l; /* left */ + *output++ = (l / 2) + (r / 2); /* center */ + *output++ = r; /* right */ + *output++ = 0; /* left surround */ + *output++ = 0; /* right surroud */ + *output++ = 0; /* low freq */ + } +} + +#define SUPPORT_RESAMPLE(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8) \ + ch8<<7 | ch7<<6 | ch6<<5 | ch5<<4 | ch4<<3 | ch3<<2 | ch2<<1 | ch1<<0 + +static const uint8_t supported_resampling[MAX_CHANNELS] = { + // output ch: 1 2 3 4 5 6 7 8 + SUPPORT_RESAMPLE(1, 1, 0, 0, 0, 0, 0, 0), // 1 input channel + SUPPORT_RESAMPLE(1, 1, 0, 0, 0, 1, 0, 0), // 2 input channels + SUPPORT_RESAMPLE(0, 0, 1, 0, 0, 0, 0, 0), // 3 input channels + SUPPORT_RESAMPLE(0, 0, 0, 1, 0, 0, 0, 0), // 4 input channels + SUPPORT_RESAMPLE(0, 0, 0, 0, 1, 0, 0, 0), // 5 input channels + SUPPORT_RESAMPLE(0, 1, 0, 0, 0, 1, 0, 0), // 6 input channels + SUPPORT_RESAMPLE(0, 0, 0, 0, 0, 0, 1, 0), // 7 input channels + SUPPORT_RESAMPLE(0, 0, 0, 0, 0, 0, 0, 1), // 8 input channels +}; + +ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, + int output_rate, int input_rate, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, + int filter_length, int log2_phase_count, + int linear, double cutoff) +{ + ReSampleContext *s; + + if (input_channels > MAX_CHANNELS) { + av_log(NULL, AV_LOG_ERROR, + "Resampling with input channels greater than %d is unsupported.\n", + MAX_CHANNELS); + return NULL; + } + if (!(supported_resampling[input_channels-1] & (1<<(output_channels-1)))) { + int i; + av_log(NULL, AV_LOG_ERROR, "Unsupported audio resampling. Allowed " + "output channels for %d input channel%s", input_channels, + input_channels > 1 ? "s:" : ":"); + for (i = 0; i < MAX_CHANNELS; i++) + if (supported_resampling[input_channels-1] & (1<<i)) + av_log(NULL, AV_LOG_ERROR, " %d", i + 1); + av_log(NULL, AV_LOG_ERROR, "\n"); + return NULL; + } + + s = av_mallocz(sizeof(ReSampleContext)); + if (!s) { + av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n"); + return NULL; + } + + s->ratio = (float)output_rate / (float)input_rate; + + s->input_channels = input_channels; + s->output_channels = output_channels; + + s->filter_channels = s->input_channels; + if (s->output_channels < s->filter_channels) + s->filter_channels = s->output_channels; + + s->sample_fmt[0] = sample_fmt_in; + s->sample_fmt[1] = sample_fmt_out; + s->sample_size[0] = av_get_bytes_per_sample(s->sample_fmt[0]); + s->sample_size[1] = av_get_bytes_per_sample(s->sample_fmt[1]); + + if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { + if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, + s->sample_fmt[0], 1, NULL, 0))) { + av_log(s, AV_LOG_ERROR, + "Cannot convert %s sample format to s16 sample format\n", + av_get_sample_fmt_name(s->sample_fmt[0])); + av_free(s); + return NULL; + } + } + + if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { + if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1, + AV_SAMPLE_FMT_S16, 1, NULL, 0))) { + av_log(s, AV_LOG_ERROR, + "Cannot convert s16 sample format to %s sample format\n", + av_get_sample_fmt_name(s->sample_fmt[1])); + av_audio_convert_free(s->convert_ctx[0]); + av_free(s); + return NULL; + } + } + + s->resample_context = av_resample_init(output_rate, input_rate, + filter_length, log2_phase_count, + linear, cutoff); + + *(const AVClass**)s->resample_context = &audioresample_context_class; + + return s; +} + +/* resample audio. 'nb_samples' is the number of input samples */ +/* XXX: optimize it ! */ +int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples) +{ + int i, nb_samples1; + short *bufin[MAX_CHANNELS]; + short *bufout[MAX_CHANNELS]; + short *buftmp2[MAX_CHANNELS], *buftmp3[MAX_CHANNELS]; + short *output_bak = NULL; + int lenout; + + if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { + int istride[1] = { s->sample_size[0] }; + int ostride[1] = { 2 }; + const void *ibuf[1] = { input }; + void *obuf[1]; + unsigned input_size = nb_samples * s->input_channels * 2; + + if (!s->buffer_size[0] || s->buffer_size[0] < input_size) { + av_free(s->buffer[0]); + s->buffer_size[0] = input_size; + s->buffer[0] = av_malloc(s->buffer_size[0]); + if (!s->buffer[0]) { + av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n"); + return 0; + } + } + + obuf[0] = s->buffer[0]; + + if (av_audio_convert(s->convert_ctx[0], obuf, ostride, + ibuf, istride, nb_samples * s->input_channels) < 0) { + av_log(s->resample_context, AV_LOG_ERROR, + "Audio sample format conversion failed\n"); + return 0; + } + + input = s->buffer[0]; + } + + lenout= 2*s->output_channels*nb_samples * s->ratio + 16; + + if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { + int out_size = lenout * av_get_bytes_per_sample(s->sample_fmt[1]) * + s->output_channels; + output_bak = output; + + if (!s->buffer_size[1] || s->buffer_size[1] < out_size) { + av_free(s->buffer[1]); + s->buffer_size[1] = out_size; + s->buffer[1] = av_malloc(s->buffer_size[1]); + if (!s->buffer[1]) { + av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n"); + return 0; + } + } + + output = s->buffer[1]; + } + + /* XXX: move those malloc to resample init code */ + for (i = 0; i < s->filter_channels; i++) { + bufin[i] = av_malloc_array((nb_samples + s->temp_len), sizeof(short)); + bufout[i] = av_malloc_array(lenout, sizeof(short)); + + if (!bufin[i] || !bufout[i]) { + av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n"); + nb_samples1 = 0; + goto fail; + } + + memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short)); + buftmp2[i] = bufin[i] + s->temp_len; + } + + if (s->input_channels == 2 && s->output_channels == 1) { + buftmp3[0] = output; + stereo_to_mono(buftmp2[0], input, nb_samples); + } else if (s->output_channels >= 2 && s->input_channels == 1) { + buftmp3[0] = bufout[0]; + memcpy(buftmp2[0], input, nb_samples * sizeof(short)); + } else if (s->input_channels == 6 && s->output_channels ==2) { + buftmp3[0] = bufout[0]; + buftmp3[1] = bufout[1]; + surround_to_stereo(buftmp2, input, s->input_channels, nb_samples); + } else if (s->output_channels >= s->input_channels && s->input_channels >= 2) { + for (i = 0; i < s->input_channels; i++) { + buftmp3[i] = bufout[i]; + } + deinterleave(buftmp2, input, s->input_channels, nb_samples); + } else { + buftmp3[0] = output; + memcpy(buftmp2[0], input, nb_samples * sizeof(short)); + } + + nb_samples += s->temp_len; + + /* resample each channel */ + nb_samples1 = 0; /* avoid warning */ + for (i = 0; i < s->filter_channels; i++) { + int consumed; + int is_last = i + 1 == s->filter_channels; + + nb_samples1 = av_resample(s->resample_context, buftmp3[i], bufin[i], + &consumed, nb_samples, lenout, is_last); + s->temp_len = nb_samples - consumed; + s->temp[i] = av_realloc_array(s->temp[i], s->temp_len, sizeof(short)); + memcpy(s->temp[i], bufin[i] + consumed, s->temp_len * sizeof(short)); + } + + if (s->output_channels == 2 && s->input_channels == 1) { + mono_to_stereo(output, buftmp3[0], nb_samples1); + } else if (s->output_channels == 6 && s->input_channels == 2) { + ac3_5p1_mux(output, buftmp3[0], buftmp3[1], nb_samples1); + } else if ((s->output_channels == s->input_channels && s->input_channels >= 2) || + (s->output_channels == 2 && s->input_channels == 6)) { + interleave(output, buftmp3, s->output_channels, nb_samples1); + } + + if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { + int istride[1] = { 2 }; + int ostride[1] = { s->sample_size[1] }; + const void *ibuf[1] = { output }; + void *obuf[1] = { output_bak }; + + if (av_audio_convert(s->convert_ctx[1], obuf, ostride, + ibuf, istride, nb_samples1 * s->output_channels) < 0) { + av_log(s->resample_context, AV_LOG_ERROR, + "Audio sample format conversion failed\n"); + return 0; + } + } + +fail: + for (i = 0; i < s->filter_channels; i++) { + av_free(bufin[i]); + av_free(bufout[i]); + } + + return nb_samples1; +} + +void audio_resample_close(ReSampleContext *s) +{ + int i; + av_resample_close(s->resample_context); + for (i = 0; i < s->filter_channels; i++) + av_freep(&s->temp[i]); + av_freep(&s->buffer[0]); + av_freep(&s->buffer[1]); + av_audio_convert_free(s->convert_ctx[0]); + av_audio_convert_free(s->convert_ctx[1]); + av_free(s); +} + +FF_ENABLE_DEPRECATION_WARNINGS +#endif diff --git a/media/ffvpx/libavcodec/resample2.c b/media/ffvpx/libavcodec/resample2.c new file mode 100644 index 000000000..56ae9f722 --- /dev/null +++ b/media/ffvpx/libavcodec/resample2.c @@ -0,0 +1,319 @@ +/* + * audio resampling + * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * audio resampling + * @author Michael Niedermayer <michaelni@gmx.at> + */ + +#include "libavutil/avassert.h" +#include "avcodec.h" +#include "libavutil/common.h" + +#if FF_API_AVCODEC_RESAMPLE + +#ifndef CONFIG_RESAMPLE_HP +#define FILTER_SHIFT 15 + +typedef int16_t FELEM; +typedef int32_t FELEM2; +typedef int64_t FELEML; +#define FELEM_MAX INT16_MAX +#define FELEM_MIN INT16_MIN +#define WINDOW_TYPE 9 +#elif !defined(CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE) +#define FILTER_SHIFT 30 + +#define FELEM int32_t +#define FELEM2 int64_t +#define FELEML int64_t +#define FELEM_MAX INT32_MAX +#define FELEM_MIN INT32_MIN +#define WINDOW_TYPE 12 +#else +#define FILTER_SHIFT 0 + +typedef double FELEM; +typedef double FELEM2; +typedef double FELEML; +#define WINDOW_TYPE 24 +#endif + + +typedef struct AVResampleContext{ + const AVClass *av_class; + FELEM *filter_bank; + int filter_length; + int ideal_dst_incr; + int dst_incr; + int index; + int frac; + int src_incr; + int compensation_distance; + int phase_shift; + int phase_mask; + int linear; +}AVResampleContext; + +/** + * 0th order modified bessel function of the first kind. + */ +static double bessel(double x){ + double v=1; + double lastv=0; + double t=1; + int i; + + x= x*x/4; + for(i=1; v != lastv; i++){ + lastv=v; + t *= x/(i*i); + v += t; + } + return v; +} + +/** + * Build a polyphase filterbank. + * @param factor resampling factor + * @param scale wanted sum of coefficients for each filter + * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser windowed sinc beta=2..16 + * @return 0 on success, negative on error + */ +static int build_filter(FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type){ + int ph, i; + double x, y, w; + double *tab = av_malloc_array(tap_count, sizeof(*tab)); + const int center= (tap_count-1)/2; + + if (!tab) + return AVERROR(ENOMEM); + + /* if upsampling, only need to interpolate, no filter */ + if (factor > 1.0) + factor = 1.0; + + for(ph=0;ph<phase_count;ph++) { + double norm = 0; + for(i=0;i<tap_count;i++) { + x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor; + if (x == 0) y = 1.0; + else y = sin(x) / x; + switch(type){ + case 0:{ + const float d= -0.5; //first order derivative = -0.5 + x = fabs(((double)(i - center) - (double)ph / phase_count) * factor); + if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x); + else y= d*(-4 + 8*x - 5*x*x + x*x*x); + break;} + case 1: + w = 2.0*x / (factor*tap_count) + M_PI; + y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w); + break; + default: + w = 2.0*x / (factor*tap_count*M_PI); + y *= bessel(type*sqrt(FFMAX(1-w*w, 0))); + break; + } + + tab[i] = y; + norm += y; + } + + /* normalize so that an uniform color remains the same */ + for(i=0;i<tap_count;i++) { +#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE + filter[ph * tap_count + i] = tab[i] / norm; +#else + filter[ph * tap_count + i] = av_clip(lrintf(tab[i] * scale / norm), FELEM_MIN, FELEM_MAX); +#endif + } + } +#if 0 + { +#define LEN 1024 + int j,k; + double sine[LEN + tap_count]; + double filtered[LEN]; + double maxff=-2, minff=2, maxsf=-2, minsf=2; + for(i=0; i<LEN; i++){ + double ss=0, sf=0, ff=0; + for(j=0; j<LEN+tap_count; j++) + sine[j]= cos(i*j*M_PI/LEN); + for(j=0; j<LEN; j++){ + double sum=0; + ph=0; + for(k=0; k<tap_count; k++) + sum += filter[ph * tap_count + k] * sine[k+j]; + filtered[j]= sum / (1<<FILTER_SHIFT); + ss+= sine[j + center] * sine[j + center]; + ff+= filtered[j] * filtered[j]; + sf+= sine[j + center] * filtered[j]; + } + ss= sqrt(2*ss/LEN); + ff= sqrt(2*ff/LEN); + sf= 2*sf/LEN; + maxff= FFMAX(maxff, ff); + minff= FFMIN(minff, ff); + maxsf= FFMAX(maxsf, sf); + minsf= FFMIN(minsf, sf); + if(i%11==0){ + av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf); + minff=minsf= 2; + maxff=maxsf= -2; + } + } + } +#endif + + av_free(tab); + return 0; +} + +AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){ + AVResampleContext *c= av_mallocz(sizeof(AVResampleContext)); + double factor= FFMIN(out_rate * cutoff / in_rate, 1.0); + int phase_count= 1<<phase_shift; + + if (!c) + return NULL; + + c->phase_shift= phase_shift; + c->phase_mask= phase_count-1; + c->linear= linear; + + c->filter_length= FFMAX((int)ceil(filter_size/factor), 1); + c->filter_bank= av_mallocz_array(c->filter_length, (phase_count+1)*sizeof(FELEM)); + if (!c->filter_bank) + goto error; + if (build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, WINDOW_TYPE)) + goto error; + memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM)); + c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1]; + + if(!av_reduce(&c->src_incr, &c->dst_incr, out_rate, in_rate * (int64_t)phase_count, INT32_MAX/2)) + goto error; + c->ideal_dst_incr= c->dst_incr; + + c->index= -phase_count*((c->filter_length-1)/2); + + return c; +error: + av_free(c->filter_bank); + av_free(c); + return NULL; +} + +void av_resample_close(AVResampleContext *c){ + av_freep(&c->filter_bank); + av_freep(&c); +} + +void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){ +// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr; + c->compensation_distance= compensation_distance; + c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; +} + +int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){ + int dst_index, i; + int index= c->index; + int frac= c->frac; + int dst_incr_frac= c->dst_incr % c->src_incr; + int dst_incr= c->dst_incr / c->src_incr; + int compensation_distance= c->compensation_distance; + + if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){ + int64_t index2= ((int64_t)index)<<32; + int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; + dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr); + + for(dst_index=0; dst_index < dst_size; dst_index++){ + dst[dst_index] = src[index2>>32]; + index2 += incr; + } + index += dst_index * dst_incr; + index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr; + frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr; + }else{ + for(dst_index=0; dst_index < dst_size; dst_index++){ + FELEM *filter= c->filter_bank + c->filter_length*(index & c->phase_mask); + int sample_index= index >> c->phase_shift; + FELEM2 val=0; + + if(sample_index < 0){ + for(i=0; i<c->filter_length; i++) + val += src[FFABS(sample_index + i) % src_size] * filter[i]; + }else if(sample_index + c->filter_length > src_size){ + break; + }else if(c->linear){ + FELEM2 v2=0; + for(i=0; i<c->filter_length; i++){ + val += src[sample_index + i] * (FELEM2)filter[i]; + v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_length]; + } + val+=(v2-val)*(FELEML)frac / c->src_incr; + }else{ + for(i=0; i<c->filter_length; i++){ + val += src[sample_index + i] * (FELEM2)filter[i]; + } + } + +#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE + dst[dst_index] = av_clip_int16(lrintf(val)); +#else + val = (val + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT; + dst[dst_index] = (unsigned)(val + 32768) > 65535 ? (val>>31) ^ 32767 : val; +#endif + + frac += dst_incr_frac; + index += dst_incr; + if(frac >= c->src_incr){ + frac -= c->src_incr; + index++; + } + + if(dst_index + 1 == compensation_distance){ + compensation_distance= 0; + dst_incr_frac= c->ideal_dst_incr % c->src_incr; + dst_incr= c->ideal_dst_incr / c->src_incr; + } + } + } + *consumed= FFMAX(index, 0) >> c->phase_shift; + if(index>=0) index &= c->phase_mask; + + if(compensation_distance){ + compensation_distance -= dst_index; + av_assert2(compensation_distance > 0); + } + if(update_ctx){ + c->frac= frac; + c->index= index; + c->dst_incr= dst_incr_frac + c->src_incr*dst_incr; + c->compensation_distance= compensation_distance; + } + + return dst_index; +} + +#endif diff --git a/media/ffvpx/libavcodec/thread.h b/media/ffvpx/libavcodec/thread.h index 540135fbc..318619316 100644 --- a/media/ffvpx/libavcodec/thread.h +++ b/media/ffvpx/libavcodec/thread.h @@ -29,6 +29,7 @@ #include "libavutil/buffer.h" +#include "config.h" #include "avcodec.h" typedef struct ThreadFrame { diff --git a/media/ffvpx/libavcodec/utils.c b/media/ffvpx/libavcodec/utils.c index 59d41ccbb..0c47e761f 100644 --- a/media/ffvpx/libavcodec/utils.c +++ b/media/ffvpx/libavcodec/utils.c @@ -26,6 +26,7 @@ */ #include "config.h" +#include "libavutil/atomic.h" #include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" @@ -44,8 +45,8 @@ #include "libavutil/thread.h" #include "avcodec.h" #include "decode.h" -#include "hwaccel.h" #include "libavutil/opt.h" +#include "me_cmp.h" #include "mpegvideo.h" #include "thread.h" #include "frame_thread_encoder.h" @@ -55,7 +56,6 @@ #include "version.h" #include <stdlib.h> #include <stdarg.h> -#include <stdatomic.h> #include <limits.h> #include <float.h> #if CONFIG_ICONV @@ -65,7 +65,58 @@ #include "libavutil/ffversion.h" const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION; -static AVMutex codec_mutex = AV_MUTEX_INITIALIZER; +#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS +static int default_lockmgr_cb(void **arg, enum AVLockOp op) +{ + void * volatile * mutex = arg; + int err; + + switch (op) { + case AV_LOCK_CREATE: + return 0; + case AV_LOCK_OBTAIN: + if (!*mutex) { + pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t)); + if (!tmp) + return AVERROR(ENOMEM); + if ((err = pthread_mutex_init(tmp, NULL))) { + av_free(tmp); + return AVERROR(err); + } + if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) { + pthread_mutex_destroy(tmp); + av_free(tmp); + } + } + + if ((err = pthread_mutex_lock(*mutex))) + return AVERROR(err); + + return 0; + case AV_LOCK_RELEASE: + if ((err = pthread_mutex_unlock(*mutex))) + return AVERROR(err); + + return 0; + case AV_LOCK_DESTROY: + if (*mutex) + pthread_mutex_destroy(*mutex); + av_free(*mutex); + avpriv_atomic_ptr_cas(mutex, *mutex, NULL); + return 0; + } + return 1; +} +static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) = default_lockmgr_cb; +#else +static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) = NULL; +#endif + + +volatile int ff_avcodec_locked; +static int volatile entangled_thread_counter = 0; +static void *codec_mutex; +static void *avformat_mutex; void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) { @@ -91,6 +142,30 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size) memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE); } +/* encoder management */ +static AVCodec *first_avcodec = NULL; +static AVCodec **last_avcodec = &first_avcodec; + +AVCodec *av_codec_next(const AVCodec *c) +{ + if (c) + return c->next; + else + return first_avcodec; +} + +static av_cold void avcodec_init(void) +{ + static int initialized = 0; + + if (initialized != 0) + return; + initialized = 1; + + if (CONFIG_ME_CMP) + ff_me_cmp_init_static(); +} + int av_codec_is_encoder(const AVCodec *codec) { return codec && (codec->encode_sub || codec->encode2 ||codec->send_frame); @@ -101,6 +176,38 @@ int av_codec_is_decoder(const AVCodec *codec) return codec && (codec->decode || codec->receive_frame); } +av_cold void avcodec_register(AVCodec *codec) +{ + AVCodec **p; + avcodec_init(); + p = last_avcodec; + codec->next = NULL; + + while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, codec)) + p = &(*p)->next; + last_avcodec = &codec->next; + + if (codec->init_static_data) + codec->init_static_data(codec); +} + +#if FF_API_EMU_EDGE +unsigned avcodec_get_edge_width(void) +{ + return EDGE_WIDTH; +} +#endif + +#if FF_API_SET_DIMENSIONS +void avcodec_set_dimensions(AVCodecContext *s, int width, int height) +{ + int ret = ff_set_dimensions(s, width, height); + if (ret < 0) { + av_log(s, AV_LOG_WARNING, "Failed to set dimensions %d %d\n", width, height); + } +} +#endif + int ff_set_dimensions(AVCodecContext *s, int width, int height) { int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s); @@ -312,10 +419,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, *width = FFALIGN(*width, w_align); *height = FFALIGN(*height, h_align); - if (s->codec_id == AV_CODEC_ID_H264 || s->lowres || - s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 || - s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A - ) { + if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) { // some of the optimized chroma MC reads one line too much // which is also done in mpeg decoders with lowres > 0 *height += 2; @@ -465,7 +569,6 @@ enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, return AV_PIX_FMT_NONE; } -#if FF_API_CODEC_GET_SET MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase) MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor) MAKE_ACCESSORS(AVCodecContext, codec, int, lowres) @@ -481,7 +584,6 @@ int av_codec_get_max_lowres(const AVCodec *codec) { return codec->max_lowres; } -#endif int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec){ return !!(codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM); @@ -510,19 +612,6 @@ static int64_t get_bit_rate(AVCodecContext *ctx) return bit_rate; } - -static void ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) -{ - if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) - ff_mutex_lock(&codec_mutex); -} - -static void ff_unlock_avcodec(const AVCodec *codec) -{ - if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) - ff_mutex_unlock(&codec_mutex); -} - int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; @@ -562,7 +651,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if (options) av_dict_copy(&tmp, *options, 0); - ff_lock_avcodec(avctx, codec); + ret = ff_lock_avcodec(avctx, codec); + if (ret < 0) + return ret; avctx->internal = av_mallocz(sizeof(*avctx->internal)); if (!avctx->internal) { @@ -742,6 +833,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->lowres = avctx->codec->max_lowres; } +#if FF_API_VISMV + if (avctx->debug_mv) + av_log(avctx, AV_LOG_WARNING, "The 'vismv' option is deprecated, " + "see the codecview filter instead.\n"); +#endif + if (av_codec_is_encoder(avctx->codec)) { int i; #if FF_API_CODED_FRAME @@ -928,6 +1025,11 @@ FF_ENABLE_DEPRECATION_WARNINGS ret=0; +#if FF_API_AUDIOENC_DELAY + if (av_codec_is_encoder(avctx->codec)) + avctx->delay = avctx->initial_padding; +#endif + if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); @@ -1124,6 +1226,71 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } +static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) +{ + switch(id){ + //This is for future deprecatec codec ids, its empty since + //last major bump but will fill up again over time, please don't remove it + default : return id; + } +} + +static AVCodec *find_encdec(enum AVCodecID id, int encoder) +{ + AVCodec *p, *experimental = NULL; + p = first_avcodec; + id= remap_deprecated_codec_id(id); + while (p) { + if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) && + p->id == id) { + if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) { + experimental = p; + } else + return p; + } + p = p->next; + } + return experimental; +} + +AVCodec *avcodec_find_encoder(enum AVCodecID id) +{ + return find_encdec(id, 1); +} + +AVCodec *avcodec_find_encoder_by_name(const char *name) +{ + AVCodec *p; + if (!name) + return NULL; + p = first_avcodec; + while (p) { + if (av_codec_is_encoder(p) && strcmp(name, p->name) == 0) + return p; + p = p->next; + } + return NULL; +} + +AVCodec *avcodec_find_decoder(enum AVCodecID id) +{ + return find_encdec(id, 0); +} + +AVCodec *avcodec_find_decoder_by_name(const char *name) +{ + AVCodec *p; + if (!name) + return NULL; + p = first_avcodec; + while (p) { + if (av_codec_is_decoder(p) && strcmp(name, p->name) == 0) + return p; + p = p->next; + } + return NULL; +} + const char *avcodec_get_name(enum AVCodecID id) { const AVCodecDescriptor *cd; @@ -1669,13 +1836,13 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, /* calc from frame_bytes, channels, and bits_per_coded_sample */ switch (id) { case AV_CODEC_ID_PCM_DVD: - if(bps<4 || frame_bytes<3) + if(bps<4) return 0; - return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch)); + return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); case AV_CODEC_ID_PCM_BLURAY: - if(bps<4 || frame_bytes<4) + if(bps<4) return 0; - return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8); + return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); case AV_CODEC_ID_S302M: return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; } @@ -1744,34 +1911,143 @@ int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b) return i; } -const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index) +#if FF_API_MISSING_SAMPLE +FF_DISABLE_DEPRECATION_WARNINGS +void av_log_missing_feature(void *avc, const char *feature, int want_sample) { - int i; - if (!codec->hw_configs || index < 0) - return NULL; - for (i = 0; i <= index; i++) - if (!codec->hw_configs[i]) - return NULL; - return &codec->hw_configs[index]->public; + av_log(avc, AV_LOG_WARNING, "%s is not implemented. Update your FFmpeg " + "version to the newest one from Git. If the problem still " + "occurs, it means that your file has a feature which has not " + "been implemented.\n", feature); + if(want_sample) + av_log_ask_for_sample(avc, NULL); } -#if FF_API_USER_VISIBLE_AVHWACCEL -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel) +void av_log_ask_for_sample(void *avc, const char *msg, ...) { - return NULL; + va_list argument_list; + + va_start(argument_list, msg); + + if (msg) + av_vlog(avc, AV_LOG_WARNING, msg, argument_list); + av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample " + "of this file to ftp://upload.ffmpeg.org/incoming/ " + "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)\n"); + + va_end(argument_list); } +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* FF_API_MISSING_SAMPLE */ + +static AVHWAccel *first_hwaccel = NULL; +static AVHWAccel **last_hwaccel = &first_hwaccel; void av_register_hwaccel(AVHWAccel *hwaccel) { + AVHWAccel **p = last_hwaccel; + hwaccel->next = NULL; + while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, hwaccel)) + p = &(*p)->next; + last_hwaccel = &hwaccel->next; +} + +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel) +{ + return hwaccel ? hwaccel->next : first_hwaccel; } -#endif -#if FF_API_LOCKMGR int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) { + if (lockmgr_cb) { + // There is no good way to rollback a failure to destroy the + // mutex, so we ignore failures. + lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY); + lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY); + lockmgr_cb = NULL; + codec_mutex = NULL; + avformat_mutex = NULL; + } + + if (cb) { + void *new_codec_mutex = NULL; + void *new_avformat_mutex = NULL; + int err; + if (err = cb(&new_codec_mutex, AV_LOCK_CREATE)) { + return err > 0 ? AVERROR_UNKNOWN : err; + } + if (err = cb(&new_avformat_mutex, AV_LOCK_CREATE)) { + // Ignore failures to destroy the newly created mutex. + cb(&new_codec_mutex, AV_LOCK_DESTROY); + return err > 0 ? AVERROR_UNKNOWN : err; + } + lockmgr_cb = cb; + codec_mutex = new_codec_mutex; + avformat_mutex = new_avformat_mutex; + } + + return 0; +} + +int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) +{ + if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) + return 0; + + if (lockmgr_cb) { + if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) + return -1; + } + + if (avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, 1) != 1) { + av_log(log_ctx, AV_LOG_ERROR, + "Insufficient thread locking. At least %d threads are " + "calling avcodec_open2() at the same time right now.\n", + entangled_thread_counter); + if (!lockmgr_cb) + av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see av_lockmgr_register()\n"); + ff_avcodec_locked = 1; + ff_unlock_avcodec(codec); + return AVERROR(EINVAL); + } + av_assert0(!ff_avcodec_locked); + ff_avcodec_locked = 1; + return 0; +} + +int ff_unlock_avcodec(const AVCodec *codec) +{ + if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) + return 0; + + av_assert0(ff_avcodec_locked); + ff_avcodec_locked = 0; + avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1); + if (lockmgr_cb) { + if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) + return -1; + } + + return 0; +} + +int avpriv_lock_avformat(void) +{ + if (lockmgr_cb) { + if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_OBTAIN)) + return -1; + } + return 0; +} + +int avpriv_unlock_avformat(void) +{ + if (lockmgr_cb) { + if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) + return -1; + } return 0; } -#endif unsigned int avpriv_toupper4(unsigned int x) { diff --git a/media/ffvpx/libavcodec/version.h b/media/ffvpx/libavcodec/version.h index 6895f1a46..10d9ac4eb 100644 --- a/media/ffvpx/libavcodec/version.h +++ b/media/ffvpx/libavcodec/version.h @@ -27,8 +27,8 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 18 +#define LIBAVCODEC_VERSION_MAJOR 57 +#define LIBAVCODEC_VERSION_MINOR 107 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -51,18 +51,136 @@ * at once through the bump. This improves the git bisect-ability of the change. */ +#ifndef FF_API_VIMA_DECODER +#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AUDIO_CONVERT +#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AVCODEC_RESAMPLE +#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT +#endif +#ifndef FF_API_MISSING_SAMPLE +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif #ifndef FF_API_LOWRES -#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59) +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_CAP_VDPAU +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_BUFS_VDPAU +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VOXWARE +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) #endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_ALPHA +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ERROR_RATE +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_QSCALE_TYPE +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MB_TYPE +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MAX_BFRAMES +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_NEG_LINESIZES +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_EMU_EDGE +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_SH4 +#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_SPARC +#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_UNUSED_MEMBERS +#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_IDCT_XVIDMMX +#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_INPUT_PRESERVED +#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_NORMALIZE_AQP +#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_GMC +#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MV0 +#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_CODEC_NAME +#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AFD +#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VISMV +/* XXX: don't forget to drop the -vismv documentation */ +#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AUDIOENC_DELAY +#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VAAPI_CONTEXT +#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MERGE_SD +#define FF_API_MERGE_SD (LIBAVCODEC_VERSION_MAJOR < 58) +#endif #ifndef FF_API_AVCTX_TIMEBASE #define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_MPV_OPT +#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STREAM_CODEC_TAG +#define FF_API_STREAM_CODEC_TAG (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_QUANT_BIAS +#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RC_STRATEGY +#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #ifndef FF_API_CODED_FRAME #define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_MOTION_EST +#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_WITHOUT_PREFIX +#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #ifndef FF_API_SIDEDATA_ONLY_PKT #define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) #endif @@ -120,18 +238,6 @@ #ifndef FF_API_GETCHROMA #define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) #endif -#ifndef FF_API_CODEC_GET_SET -#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_USER_VISIBLE_AVHWACCEL -#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_LOCKMGR -#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NEXT -#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif #endif /* AVCODEC_VERSION_H */ diff --git a/media/ffvpx/libavcodec/vp8.c b/media/ffvpx/libavcodec/vp8.c index 62b9f8bc2..7841a9d96 100644 --- a/media/ffvpx/libavcodec/vp8.c +++ b/media/ffvpx/libavcodec/vp8.c @@ -27,7 +27,6 @@ #include "libavutil/imgutils.h" #include "avcodec.h" -#include "hwaccel.h" #include "internal.h" #include "mathops.h" #include "rectangle.h" @@ -73,30 +72,16 @@ static int vp8_alloc_frame(VP8Context *s, VP8Frame *f, int ref) if ((ret = ff_thread_get_buffer(s->avctx, &f->tf, ref ? AV_GET_BUFFER_FLAG_REF : 0)) < 0) return ret; - if (!(f->seg_map = av_buffer_allocz(s->mb_width * s->mb_height))) - goto fail; - if (s->avctx->hwaccel) { - const AVHWAccel *hwaccel = s->avctx->hwaccel; - if (hwaccel->frame_priv_data_size) { - f->hwaccel_priv_buf = av_buffer_allocz(hwaccel->frame_priv_data_size); - if (!f->hwaccel_priv_buf) - goto fail; - f->hwaccel_picture_private = f->hwaccel_priv_buf->data; - } + if (!(f->seg_map = av_buffer_allocz(s->mb_width * s->mb_height))) { + ff_thread_release_buffer(s->avctx, &f->tf); + return AVERROR(ENOMEM); } return 0; - -fail: - av_buffer_unref(&f->seg_map); - ff_thread_release_buffer(s->avctx, &f->tf); - return AVERROR(ENOMEM); } static void vp8_release_frame(VP8Context *s, VP8Frame *f) { av_buffer_unref(&f->seg_map); - av_buffer_unref(&f->hwaccel_priv_buf); - f->hwaccel_picture_private = NULL; ff_thread_release_buffer(s->avctx, &f->tf); } @@ -114,12 +99,6 @@ static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, VP8Frame *src) vp8_release_frame(s, dst); return AVERROR(ENOMEM); } - if (src->hwaccel_picture_private) { - dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf); - if (!dst->hwaccel_priv_buf) - return AVERROR(ENOMEM); - dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; - } return 0; } @@ -161,28 +140,12 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s) av_log(s->avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } - if (frame->tf.f->buf[0]) + if (frame->tf.f->data[0]) vp8_release_frame(s, frame); return frame; } -static enum AVPixelFormat get_pixel_format(VP8Context *s) -{ - enum AVPixelFormat pix_fmts[] = { -#if CONFIG_VP8_VAAPI_HWACCEL - AV_PIX_FMT_VAAPI, -#endif -#if CONFIG_VP8_NVDEC_HWACCEL - AV_PIX_FMT_CUDA, -#endif - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NONE, - }; - - return ff_get_format(s->avctx, pix_fmts); -} - static av_always_inline int update_dimensions(VP8Context *s, int width, int height, int is_vp7) { @@ -198,13 +161,6 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7) return ret; } - if (!s->actually_webp && !is_vp7) { - s->pix_fmt = get_pixel_format(s); - if (s->pix_fmt < 0) - return AVERROR(EINVAL); - avctx->pix_fmt = s->pix_fmt; - } - s->mb_width = (s->avctx->coded_width + 15) / 16; s->mb_height = (s->avctx->coded_height + 15) / 16; @@ -262,9 +218,8 @@ static void parse_segment_info(VP8Context *s) int i; s->segmentation.update_map = vp8_rac_get(c); - s->segmentation.update_feature_data = vp8_rac_get(c); - if (s->segmentation.update_feature_data) { + if (vp8_rac_get(c)) { // update segment feature data s->segmentation.absolute_vals = vp8_rac_get(c); for (i = 0; i < 4; i++) @@ -319,7 +274,6 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size) int size = AV_RL24(sizes + 3 * i); if (buf_size - size < 0) return -1; - s->coeff_partition_size[i] = size; ret = ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size); if (ret < 0) @@ -327,11 +281,7 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size) buf += size; buf_size -= size; } - - s->coeff_partition_size[i] = buf_size; - ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size); - - return 0; + return ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size); } static void vp7_get_quants(VP8Context *s) @@ -358,28 +308,28 @@ static void vp8_get_quants(VP8Context *s) VP56RangeCoder *c = &s->c; int i, base_qi; - s->quant.yac_qi = vp8_rac_get_uint(c, 7); - s->quant.ydc_delta = vp8_rac_get_sint(c, 4); - s->quant.y2dc_delta = vp8_rac_get_sint(c, 4); - s->quant.y2ac_delta = vp8_rac_get_sint(c, 4); - s->quant.uvdc_delta = vp8_rac_get_sint(c, 4); - s->quant.uvac_delta = vp8_rac_get_sint(c, 4); + int yac_qi = vp8_rac_get_uint(c, 7); + int ydc_delta = vp8_rac_get_sint(c, 4); + int y2dc_delta = vp8_rac_get_sint(c, 4); + int y2ac_delta = vp8_rac_get_sint(c, 4); + int uvdc_delta = vp8_rac_get_sint(c, 4); + int uvac_delta = vp8_rac_get_sint(c, 4); for (i = 0; i < 4; i++) { if (s->segmentation.enabled) { base_qi = s->segmentation.base_quant[i]; if (!s->segmentation.absolute_vals) - base_qi += s->quant.yac_qi; + base_qi += yac_qi; } else - base_qi = s->quant.yac_qi; + base_qi = yac_qi; - s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + s->quant.ydc_delta, 7)]; + s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + ydc_delta, 7)]; s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi, 7)]; - s->qmat[i].luma_dc_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + s->quant.y2dc_delta, 7)] * 2; + s->qmat[i].luma_dc_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + y2dc_delta, 7)] * 2; /* 101581>>16 is equivalent to 155/100 */ - s->qmat[i].luma_dc_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + s->quant.y2ac_delta, 7)] * 101581 >> 16; - s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + s->quant.uvdc_delta, 7)]; - s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + s->quant.uvac_delta, 7)]; + s->qmat[i].luma_dc_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + y2ac_delta, 7)] * 101581 >> 16; + s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + uvdc_delta, 7)]; + s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + uvac_delta, 7)]; s->qmat[i].luma_dc_qmul[1] = FFMAX(s->qmat[i].luma_dc_qmul[1], 8); s->qmat[i].chroma_qmul[0] = FFMIN(s->qmat[i].chroma_qmul[0], 132); @@ -656,8 +606,6 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si s->fade_present = vp8_rac_get(c); } - if (c->end <= c->buffer && c->bits >= 0) - return AVERROR_INVALIDDATA; /* E. Fading information for previous frame */ if (s->fade_present && vp8_rac_get(c)) { if ((ret = vp7_fade_frame(s ,c)) < 0) @@ -713,8 +661,6 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si buf += 3; buf_size -= 3; - s->header_partition_size = header_size; - if (s->profile > 3) av_log(s->avctx, AV_LOG_WARNING, "Unknown profile %d\n", s->profile); @@ -780,11 +726,9 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si s->filter.level = vp8_rac_get_uint(c, 6); s->filter.sharpness = vp8_rac_get_uint(c, 3); - if ((s->lf_delta.enabled = vp8_rac_get(c))) { - s->lf_delta.update = vp8_rac_get(c); - if (s->lf_delta.update) + if ((s->lf_delta.enabled = vp8_rac_get(c))) + if (vp8_rac_get(c)) update_lf_deltas(s); - } if (setup_partitions(s, buf, buf_size)) { av_log(s->avctx, AV_LOG_ERROR, "Invalid partitions\n"); @@ -824,13 +768,6 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si vp78_update_pred16x16_pred8x8_mvc_probabilities(s, VP8_MVC_SIZE); } - // Record the entropy coder state here so that hwaccels can use it. - s->c.code_word = vp56_rac_renorm(&s->c); - s->coder_state_at_header_end.input = s->c.buffer - (-s->c.bits / 8); - s->coder_state_at_header_end.range = s->c.high; - s->coder_state_at_header_end.value = s->c.code_word >> 16; - s->coder_state_at_header_end.bit_count = -s->c.bits % 8; - return 0; } @@ -2603,6 +2540,7 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, return vp78_decode_mb_row_sliced(avctx, tdata, jobnr, threadnr, IS_VP8); } + static av_always_inline int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt, int is_vp7) @@ -2612,6 +2550,8 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; + av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P); + if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); else @@ -2620,17 +2560,6 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (ret < 0) goto err; - if (s->actually_webp) { - // avctx->pix_fmt already set in caller. - } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) { - s->pix_fmt = get_pixel_format(s); - if (s->pix_fmt < 0) { - ret = AVERROR(EINVAL); - goto err; - } - avctx->pix_fmt = s->pix_fmt; - } - prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || @@ -2649,7 +2578,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, // release no longer referenced frames for (i = 0; i < 5; i++) - if (s->frames[i].tf.f->buf[0] && + if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && @@ -2702,70 +2631,56 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->next_framep[VP56_FRAME_CURRENT] = curframe; - ff_thread_finish_setup(avctx); - - if (avctx->hwaccel) { - ret = avctx->hwaccel->start_frame(avctx, avpkt->data, avpkt->size); - if (ret < 0) - goto err; + if (avctx->codec->update_thread_context) + ff_thread_finish_setup(avctx); - ret = avctx->hwaccel->decode_slice(avctx, avpkt->data, avpkt->size); - if (ret < 0) - goto err; - - ret = avctx->hwaccel->end_frame(avctx); - if (ret < 0) - goto err; + s->linesize = curframe->tf.f->linesize[0]; + s->uvlinesize = curframe->tf.f->linesize[1]; - } else { - s->linesize = curframe->tf.f->linesize[0]; - s->uvlinesize = curframe->tf.f->linesize[1]; + memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); + /* Zero macroblock structures for top/top-left prediction + * from outside the frame. */ + if (!s->mb_layout) + memset(s->macroblocks + s->mb_height * 2 - 1, 0, + (s->mb_width + 1) * sizeof(*s->macroblocks)); + if (!s->mb_layout && s->keyframe) + memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); - memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); - /* Zero macroblock structures for top/top-left prediction - * from outside the frame. */ - if (!s->mb_layout) - memset(s->macroblocks + s->mb_height * 2 - 1, 0, - (s->mb_width + 1) * sizeof(*s->macroblocks)); - if (!s->mb_layout && s->keyframe) - memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); - - memset(s->ref_count, 0, sizeof(s->ref_count)); - - if (s->mb_layout == 1) { - // Make sure the previous frame has read its segmentation map, - // if we re-use the same map. - if (prev_frame && s->segmentation.enabled && - !s->segmentation.update_map) - ff_thread_await_progress(&prev_frame->tf, 1, 0); - if (is_vp7) - vp7_decode_mv_mb_modes(avctx, curframe, prev_frame); - else - vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); - } + memset(s->ref_count, 0, sizeof(s->ref_count)); - if (avctx->active_thread_type == FF_THREAD_FRAME) - num_jobs = 1; - else - num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); - s->num_jobs = num_jobs; - s->curframe = curframe; - s->prev_frame = prev_frame; - s->mv_bounds.mv_min.y = -MARGIN; - s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; - for (i = 0; i < MAX_THREADS; i++) { - VP8ThreadData *td = &s->thread_data[i]; - atomic_init(&td->thread_mb_pos, 0); - atomic_init(&td->wait_mb_pos, INT_MAX); - } + if (s->mb_layout == 1) { + // Make sure the previous frame has read its segmentation map, + // if we re-use the same map. + if (prev_frame && s->segmentation.enabled && + !s->segmentation.update_map) + ff_thread_await_progress(&prev_frame->tf, 1, 0); if (is_vp7) - avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, - num_jobs); + vp7_decode_mv_mb_modes(avctx, curframe, prev_frame); else - avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, - num_jobs); + vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } + if (avctx->active_thread_type == FF_THREAD_FRAME) + num_jobs = 1; + else + num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); + s->num_jobs = num_jobs; + s->curframe = curframe; + s->prev_frame = prev_frame; + s->mv_bounds.mv_min.y = -MARGIN; + s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; + for (i = 0; i < MAX_THREADS; i++) { + VP8ThreadData *td = &s->thread_data[i]; + atomic_init(&td->thread_mb_pos, 0); + atomic_init(&td->wait_mb_pos, INT_MAX); + } + if (is_vp7) + avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL, + num_jobs); + else + avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, + num_jobs); + ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); @@ -2835,7 +2750,6 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7) s->avctx = avctx; s->vp7 = avctx->codec->id == AV_CODEC_ID_VP7; - s->pix_fmt = AV_PIX_FMT_NONE; avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->internal->allocate_progress = 1; @@ -2909,14 +2823,13 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, s->mb_height = s_src->mb_height; } - s->pix_fmt = s_src->pix_fmt; s->prob[0] = s_src->prob[!s_src->update_probabilities]; s->segmentation = s_src->segmentation; s->lf_delta = s_src->lf_delta; memcpy(s->sign_bias, s_src->sign_bias, sizeof(s->sign_bias)); for (i = 0; i < FF_ARRAY_ELEMS(s_src->frames); i++) { - if (s_src->frames[i].tf.f->buf[0]) { + if (s_src->frames[i].tf.f->data[0]) { int ret = vp8_ref_frame(s, &s->frames[i], &s_src->frames[i]); if (ret < 0) return ret; @@ -2963,14 +2876,5 @@ AVCodec ff_vp8_decoder = { .flush = vp8_decode_flush, .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp8_decode_init_thread_copy), .update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context), - .hw_configs = (const AVCodecHWConfigInternal*[]) { -#if CONFIG_VP8_VAAPI_HWACCEL - HWACCEL_VAAPI(vp8), -#endif -#if CONFIG_VP8_NVDEC_HWACCEL - HWACCEL_NVDEC(vp8), -#endif - NULL - }, }; #endif /* CONFIG_VP7_DECODER */ diff --git a/media/ffvpx/libavcodec/vp8.h b/media/ffvpx/libavcodec/vp8.h index 70d21e3c6..8263997e3 100644 --- a/media/ffvpx/libavcodec/vp8.h +++ b/media/ffvpx/libavcodec/vp8.h @@ -138,18 +138,12 @@ typedef struct VP8ThreadData { typedef struct VP8Frame { ThreadFrame tf; AVBufferRef *seg_map; - - AVBufferRef *hwaccel_priv_buf; - void *hwaccel_picture_private; } VP8Frame; #define MAX_THREADS 8 typedef struct VP8Context { VP8ThreadData *thread_data; AVCodecContext *avctx; - enum AVPixelFormat pix_fmt; - int actually_webp; - VP8Frame *framep[4]; VP8Frame *next_framep[4]; VP8Frame *curframe; @@ -178,7 +172,6 @@ typedef struct VP8Context { uint8_t enabled; uint8_t absolute_vals; uint8_t update_map; - uint8_t update_feature_data; int8_t base_quant[4]; int8_t filter_level[4]; ///< base loop filter level } segmentation; @@ -206,19 +199,8 @@ typedef struct VP8Context { int16_t chroma_qmul[2]; } qmat[4]; - // Raw quantisation values, which may be needed by hwaccel decode. - struct { - int yac_qi; - int ydc_delta; - int y2dc_delta; - int y2ac_delta; - int uvdc_delta; - int uvac_delta; - } quant; - struct { uint8_t enabled; ///< whether each mb can have a different strength based on mode/ref - uint8_t update; /** * filter strength adjustment for the following macroblock modes: @@ -246,20 +228,6 @@ typedef struct VP8Context { VP56RangeCoder c; ///< header context, includes mb modes and motion vectors - /* This contains the entropy coder state at the end of the header - * block, in the form specified by the standard. For use by - * hwaccels, so that a hardware decoder has the information to - * start decoding at the macroblock layer. - */ - struct { - const uint8_t *input; - uint32_t range; - uint32_t value; - int bit_count; - } coder_state_at_header_end; - - int header_partition_size; - /** * These are all of the updatable probabilities for binary decisions. * They are only implicitly reset on keyframes, making it quite likely @@ -297,7 +265,6 @@ typedef struct VP8Context { */ int num_coeff_partitions; VP56RangeCoder coeff_partition[8]; - int coeff_partition_size[8]; VideoDSPContext vdsp; VP8DSPContext vp8dsp; H264PredContext hpc; diff --git a/media/ffvpx/libavcodec/vp8_parser.c b/media/ffvpx/libavcodec/vp8_parser.c index e2d91b271..609f5077d 100644 --- a/media/ffvpx/libavcodec/vp8_parser.c +++ b/media/ffvpx/libavcodec/vp8_parser.c @@ -28,9 +28,6 @@ static int parse(AVCodecParserContext *s, unsigned int frame_type; unsigned int profile; - *poutbuf = buf; - *poutbuf_size = buf_size; - if (buf_size < 3) return buf_size; diff --git a/media/ffvpx/libavcodec/vp9.c b/media/ffvpx/libavcodec/vp9.c index b1178c9c0..f2cf19424 100644 --- a/media/ffvpx/libavcodec/vp9.c +++ b/media/ffvpx/libavcodec/vp9.c @@ -23,7 +23,6 @@ #include "avcodec.h" #include "get_bits.h" -#include "hwaccel.h" #include "internal.h" #include "profiles.h" #include "thread.h" @@ -170,10 +169,7 @@ fail: static int update_size(AVCodecContext *avctx, int w, int h) { -#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + \ - CONFIG_VP9_D3D11VA_HWACCEL * 2 + \ - CONFIG_VP9_NVDEC_HWACCEL + \ - CONFIG_VP9_VAAPI_HWACCEL) +#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL * 2 + CONFIG_VP9_VAAPI_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; VP9Context *s = avctx->priv_data; uint8_t *p; @@ -188,7 +184,6 @@ static int update_size(AVCodecContext *avctx, int w, int h) switch (s->pix_fmt) { case AV_PIX_FMT_YUV420P: - case AV_PIX_FMT_YUV420P10: #if CONFIG_VP9_DXVA2_HWACCEL *fmtp++ = AV_PIX_FMT_DXVA2_VLD; #endif @@ -196,17 +191,12 @@ static int update_size(AVCodecContext *avctx, int w, int h) *fmtp++ = AV_PIX_FMT_D3D11VA_VLD; *fmtp++ = AV_PIX_FMT_D3D11; #endif -#if CONFIG_VP9_NVDEC_HWACCEL - *fmtp++ = AV_PIX_FMT_CUDA; -#endif #if CONFIG_VP9_VAAPI_HWACCEL *fmtp++ = AV_PIX_FMT_VAAPI; #endif break; + case AV_PIX_FMT_YUV420P10: case AV_PIX_FMT_YUV420P12: -#if CONFIG_VP9_NVDEC_HWACCEL - *fmtp++ = AV_PIX_FMT_CUDA; -#endif #if CONFIG_VP9_VAAPI_HWACCEL *fmtp++ = AV_PIX_FMT_VAAPI; #endif @@ -1797,23 +1787,4 @@ AVCodec ff_vp9_decoder = { .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp9_decode_init_thread_copy), .update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context), .profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles), - .bsfs = "vp9_superframe_split", - .hw_configs = (const AVCodecHWConfigInternal*[]) { -#if CONFIG_VP9_DXVA2_HWACCEL - HWACCEL_DXVA2(vp9), -#endif -#if CONFIG_VP9_D3D11VA_HWACCEL - HWACCEL_D3D11VA(vp9), -#endif -#if CONFIG_VP9_D3D11VA2_HWACCEL - HWACCEL_D3D11VA2(vp9), -#endif -#if CONFIG_VP9_NVDEC_HWACCEL - HWACCEL_NVDEC(vp9), -#endif -#if CONFIG_VP9_VAAPI_HWACCEL - HWACCEL_VAAPI(vp9), -#endif - NULL - }, }; diff --git a/media/ffvpx/libavcodec/vp9_parser.c b/media/ffvpx/libavcodec/vp9_parser.c index 9531f34a3..9900e7ab1 100644 --- a/media/ffvpx/libavcodec/vp9_parser.c +++ b/media/ffvpx/libavcodec/vp9_parser.c @@ -25,19 +25,21 @@ #include "libavcodec/get_bits.h" #include "parser.h" -static int parse(AVCodecParserContext *ctx, - AVCodecContext *avctx, - const uint8_t **out_data, int *out_size, - const uint8_t *data, int size) +typedef struct VP9ParseContext { + int n_frames; // 1-8 + int size[8]; + int marker_size; + int64_t pts; +} VP9ParseContext; + +static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) { + VP9ParseContext *s = ctx->priv_data; GetBitContext gb; - int res, profile, keyframe; + int res, profile, keyframe, invisible; - *out_data = data; - *out_size = size; - - if ((res = init_get_bits8(&gb, data, size)) < 0) - return size; // parsers can't return errors + if ((res = init_get_bits8(&gb, buf, size)) < 0) + return res; get_bits(&gb, 2); // frame marker profile = get_bits1(&gb); profile |= get_bits1(&gb) << 1; @@ -45,8 +47,10 @@ static int parse(AVCodecParserContext *ctx, if (get_bits1(&gb)) { keyframe = 0; + invisible = 0; } else { keyframe = !get_bits1(&gb); + invisible = !get_bits1(&gb); } if (!keyframe) { @@ -57,10 +61,113 @@ static int parse(AVCodecParserContext *ctx, ctx->key_frame = 1; } + if (!invisible) { + if (ctx->pts == AV_NOPTS_VALUE) + ctx->pts = s->pts; + s->pts = AV_NOPTS_VALUE; + } else if (ctx->pts != AV_NOPTS_VALUE) { + s->pts = ctx->pts; + ctx->pts = AV_NOPTS_VALUE; + } + + return 0; +} + +static int parse(AVCodecParserContext *ctx, + AVCodecContext *avctx, + const uint8_t **out_data, int *out_size, + const uint8_t *data, int size) +{ + VP9ParseContext *s = ctx->priv_data; + int full_size = size; + int marker; + + if (size <= 0) { + *out_size = 0; + *out_data = data; + + return 0; + } + + if (s->n_frames > 0) { + int i; + int size_sum = 0; + + for (i = 0; i < s->n_frames ;i++) + size_sum += s->size[i]; + size_sum += s->marker_size; + + if (size_sum != size) { + av_log(avctx, AV_LOG_ERROR, "Inconsistent input frame sizes %d %d\n", + size_sum, size); + s->n_frames = 0; + } + } + + if (s->n_frames > 0) { + *out_data = data; + *out_size = s->size[--s->n_frames]; + parse_frame(ctx, *out_data, *out_size); + + return s->n_frames > 0 ? *out_size : size /* i.e. include idx tail */; + } + + marker = data[size - 1]; + if ((marker & 0xe0) == 0xc0) { + int nbytes = 1 + ((marker >> 3) & 0x3); + int n_frames = 1 + (marker & 0x7), idx_sz = 2 + n_frames * nbytes; + + if (size >= idx_sz && data[size - idx_sz] == marker) { + const uint8_t *idx = data + size + 1 - idx_sz; + int first = 1; + + switch (nbytes) { +#define case_n(a, rd) \ + case a: \ + while (n_frames--) { \ + unsigned sz = rd; \ + idx += a; \ + if (sz == 0 || sz > size) { \ + s->n_frames = 0; \ + *out_size = size; \ + *out_data = data; \ + av_log(avctx, AV_LOG_ERROR, \ + "Invalid superframe packet size: %u frame size: %d\n", \ + sz, size); \ + return full_size; \ + } \ + if (first) { \ + first = 0; \ + *out_data = data; \ + *out_size = sz; \ + s->n_frames = n_frames; \ + } else { \ + s->size[n_frames] = sz; \ + } \ + data += sz; \ + size -= sz; \ + } \ + s->marker_size = size; \ + parse_frame(ctx, *out_data, *out_size); \ + return s->n_frames > 0 ? *out_size : full_size + + case_n(1, *idx); + case_n(2, AV_RL16(idx)); + case_n(3, AV_RL24(idx)); + case_n(4, AV_RL32(idx)); + } + } + } + + *out_data = data; + *out_size = size; + parse_frame(ctx, data, size); + return size; } AVCodecParser ff_vp9_parser = { .codec_ids = { AV_CODEC_ID_VP9 }, + .priv_data_size = sizeof(VP9ParseContext), .parser_parse = parse, }; diff --git a/media/ffvpx/libavcodec/vp9_superframe_split_bsf.c b/media/ffvpx/libavcodec/vp9_superframe_split_bsf.c deleted file mode 100644 index 9c4aa33dc..000000000 --- a/media/ffvpx/libavcodec/vp9_superframe_split_bsf.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * This bitstream filter splits VP9 superframes into packets containing - * just one frame. - */ - -#include <stddef.h> - -#include "avcodec.h" -#include "bsf.h" -#include "bytestream.h" -#include "get_bits.h" - -typedef struct VP9SFSplitContext { - AVPacket buffer_pkt; - - int nb_frames; - int next_frame; - size_t next_frame_offset; - int sizes[8]; -} VP9SFSplitContext; - -static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) -{ - VP9SFSplitContext *s = ctx->priv_data; - AVPacket *in; - int i, j, ret, marker; - int is_superframe = !!s->buffer_pkt.data; - - if (!s->buffer_pkt.data) { - ret = ff_bsf_get_packet_ref(ctx, &s->buffer_pkt); - if (ret < 0) - return ret; - in = &s->buffer_pkt; - - marker = in->data[in->size - 1]; - if ((marker & 0xe0) == 0xc0) { - int length_size = 1 + ((marker >> 3) & 0x3); - int nb_frames = 1 + (marker & 0x7); - int idx_size = 2 + nb_frames * length_size; - - if (in->size >= idx_size && in->data[in->size - idx_size] == marker) { - GetByteContext bc; - int64_t total_size = 0; - - bytestream2_init(&bc, in->data + in->size + 1 - idx_size, - nb_frames * length_size); - - for (i = 0; i < nb_frames; i++) { - int frame_size = 0; - for (j = 0; j < length_size; j++) - frame_size |= bytestream2_get_byte(&bc) << (j * 8); - - total_size += frame_size; - if (frame_size < 0 || total_size > in->size - idx_size) { - av_log(ctx, AV_LOG_ERROR, - "Invalid frame size in a superframe: %d\n", frame_size); - ret = AVERROR(EINVAL); - goto fail; - } - s->sizes[i] = frame_size; - } - s->nb_frames = nb_frames; - s->next_frame = 0; - s->next_frame_offset = 0; - is_superframe = 1; - } - } - } - - if (is_superframe) { - GetBitContext gb; - int profile, invisible = 0; - - ret = av_packet_ref(out, &s->buffer_pkt); - if (ret < 0) - goto fail; - - out->data += s->next_frame_offset; - out->size = s->sizes[s->next_frame]; - - s->next_frame_offset += out->size; - s->next_frame++; - - if (s->next_frame >= s->nb_frames) - av_packet_unref(&s->buffer_pkt); - - ret = init_get_bits8(&gb, out->data, out->size); - if (ret < 0) - goto fail; - - get_bits(&gb, 2); // frame_marker - profile = get_bits1(&gb); - profile |= get_bits1(&gb) << 1; - if (profile == 3) - get_bits1(&gb); - if (!get_bits1(&gb)) { - get_bits1(&gb); - invisible = !get_bits1(&gb); - } - - if (invisible) - out->pts = AV_NOPTS_VALUE; - - } else { - av_packet_move_ref(out, &s->buffer_pkt); - } - - return 0; -fail: - if (ret < 0) - av_packet_unref(out); - av_packet_unref(&s->buffer_pkt); - return ret; -} - -static void vp9_superframe_split_uninit(AVBSFContext *ctx) -{ - VP9SFSplitContext *s = ctx->priv_data; - av_packet_unref(&s->buffer_pkt); -} - -const AVBitStreamFilter ff_vp9_superframe_split_bsf = { - .name = "vp9_superframe_split", - .priv_data_size = sizeof(VP9SFSplitContext), - .close = vp9_superframe_split_uninit, - .filter = vp9_superframe_split_filter, - .codec_ids = (const enum AVCodecID []){ AV_CODEC_ID_VP9, AV_CODEC_ID_NONE }, -}; diff --git a/media/ffvpx/libavcodec/x86/constants.c b/media/ffvpx/libavcodec/x86/constants.c index 4bfb78cc3..11002ee61 100644 --- a/media/ffvpx/libavcodec/x86/constants.c +++ b/media/ffvpx/libavcodec/x86/constants.c @@ -26,23 +26,23 @@ DECLARE_ALIGNED(32, const ymm_reg, ff_pw_1) = { 0x0001000100010001ULL, 0x000 0x0001000100010001ULL, 0x0001000100010001ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_2) = { 0x0002000200020002ULL, 0x0002000200020002ULL, 0x0002000200020002ULL, 0x0002000200020002ULL }; -DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_3) = { 0x0003000300030003ULL, 0x0003000300030003ULL }; -DECLARE_ASM_ALIGNED(32, const ymm_reg, ff_pw_4) = { 0x0004000400040004ULL, 0x0004000400040004ULL, +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3) = { 0x0003000300030003ULL, 0x0003000300030003ULL }; +DECLARE_ALIGNED(32, const ymm_reg, ff_pw_4) = { 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL }; -DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_5) = { 0x0005000500050005ULL, 0x0005000500050005ULL }; +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5) = { 0x0005000500050005ULL, 0x0005000500050005ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8) = { 0x0008000800080008ULL, 0x0008000800080008ULL }; -DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0x0009000900090009ULL }; +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0x0009000900090009ULL }; DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) = 0x000F000F000F000FULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16) = { 0x0010001000100010ULL, 0x0010001000100010ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17) = { 0x0011001100110011ULL, 0x0011001100110011ULL }; -DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_20) = { 0x0014001400140014ULL, 0x0014001400140014ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; -DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; +DECLARE_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; +DECLARE_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; +DECLARE_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; +DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_255) = { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_256) = { 0x0100010001000100ULL, 0x0100010001000100ULL, @@ -74,8 +74,7 @@ DECLARE_ALIGNED(32, const ymm_reg, ff_pb_2) = { 0x0202020202020202ULL, 0x020 DECLARE_ALIGNED(32, const ymm_reg, ff_pb_3) = { 0x0303030303030303ULL, 0x0303030303030303ULL, 0x0303030303030303ULL, 0x0303030303030303ULL }; DECLARE_ALIGNED(32, const xmm_reg, ff_pb_15) = { 0x0F0F0F0F0F0F0F0FULL, 0x0F0F0F0F0F0F0F0FULL }; -DECLARE_ALIGNED(32, const ymm_reg, ff_pb_80) = { 0x8080808080808080ULL, 0x8080808080808080ULL, - 0x8080808080808080ULL, 0x8080808080808080ULL }; +DECLARE_ALIGNED(16, const xmm_reg, ff_pb_80) = { 0x8080808080808080ULL, 0x8080808080808080ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pb_FE) = { 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL }; DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC) = 0xFCFCFCFCFCFCFCFCULL; diff --git a/media/ffvpx/libavcodec/x86/constants.h b/media/ffvpx/libavcodec/x86/constants.h index 85da38b7b..bbb0ef844 100644 --- a/media/ffvpx/libavcodec/x86/constants.h +++ b/media/ffvpx/libavcodec/x86/constants.h @@ -57,7 +57,7 @@ extern const ymm_reg ff_pb_0; extern const ymm_reg ff_pb_1; extern const ymm_reg ff_pb_2; extern const ymm_reg ff_pb_3; -extern const ymm_reg ff_pb_80; +extern const xmm_reg ff_pb_80; extern const ymm_reg ff_pb_FE; extern const uint64_t ff_pb_FC; diff --git a/media/ffvpx/libavcodec/x86/vp8dsp.asm b/media/ffvpx/libavcodec/x86/vp8dsp.asm index 75de5690a..e303b8029 100644 --- a/media/ffvpx/libavcodec/x86/vp8dsp.asm +++ b/media/ffvpx/libavcodec/x86/vp8dsp.asm @@ -664,37 +664,6 @@ INIT_XMM sse2 FILTER_V 8 %macro FILTER_BILINEAR 1 -%if cpuflag(ssse3) -cglobal put_vp8_bilinear%1_v, 7, 7, 5, dst, dststride, src, srcstride, height, picreg, my - shl myd, 4 -%ifdef PIC - lea picregq, [bilinear_filter_vb_m] -%endif - pxor m4, m4 - mova m3, [bilinear_filter_vb+myq-16] -.nextrow: - movh m0, [srcq+srcstrideq*0] - movh m1, [srcq+srcstrideq*1] - movh m2, [srcq+srcstrideq*2] - punpcklbw m0, m1 - punpcklbw m1, m2 - pmaddubsw m0, m3 - pmaddubsw m1, m3 - psraw m0, 2 - psraw m1, 2 - pavgw m0, m4 - pavgw m1, m4 -%if mmsize==8 - packuswb m0, m0 - packuswb m1, m1 - movh [dstq+dststrideq*0], m0 - movh [dstq+dststrideq*1], m1 -%else - packuswb m0, m1 - movh [dstq+dststrideq*0], m0 - movhps [dstq+dststrideq*1], m0 -%endif -%else ; cpuflag(ssse3) cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, picreg, my shl myd, 4 %ifdef PIC @@ -732,7 +701,6 @@ cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, p movh [dstq+dststrideq*0], m0 movhps [dstq+dststrideq*1], m0 %endif -%endif ; cpuflag(ssse3) lea dstq, [dstq+dststrideq*2] lea srcq, [srcq+srcstrideq*2] @@ -740,37 +708,6 @@ cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, p jg .nextrow REP_RET -%if cpuflag(ssse3) -cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 5, dst, dststride, src, srcstride, height, mx, picreg - shl mxd, 4 -%ifdef PIC - lea picregq, [bilinear_filter_vb_m] -%endif - pxor m4, m4 - mova m2, [filter_h2_shuf] - mova m3, [bilinear_filter_vb+mxq-16] -.nextrow: - movu m0, [srcq+srcstrideq*0] - movu m1, [srcq+srcstrideq*1] - pshufb m0, m2 - pshufb m1, m2 - pmaddubsw m0, m3 - pmaddubsw m1, m3 - psraw m0, 2 - psraw m1, 2 - pavgw m0, m4 - pavgw m1, m4 -%if mmsize==8 - packuswb m0, m0 - packuswb m1, m1 - movh [dstq+dststrideq*0], m0 - movh [dstq+dststrideq*1], m1 -%else - packuswb m0, m1 - movh [dstq+dststrideq*0], m0 - movhps [dstq+dststrideq*1], m0 -%endif -%else ; cpuflag(ssse3) cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg shl mxd, 4 %ifdef PIC @@ -809,7 +746,6 @@ cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 7, dst, dststride, src, srcstride movh [dstq+dststrideq*0], m0 movhps [dstq+dststrideq*1], m0 %endif -%endif ; cpuflag(ssse3) lea dstq, [dstq+dststrideq*2] lea srcq, [srcq+srcstrideq*2] @@ -822,10 +758,85 @@ INIT_MMX mmxext FILTER_BILINEAR 4 INIT_XMM sse2 FILTER_BILINEAR 8 + +%macro FILTER_BILINEAR_SSSE3 1 +cglobal put_vp8_bilinear%1_v, 7, 7, 5, dst, dststride, src, srcstride, height, picreg, my + shl myd, 4 +%ifdef PIC + lea picregq, [bilinear_filter_vb_m] +%endif + pxor m4, m4 + mova m3, [bilinear_filter_vb+myq-16] +.nextrow: + movh m0, [srcq+srcstrideq*0] + movh m1, [srcq+srcstrideq*1] + movh m2, [srcq+srcstrideq*2] + punpcklbw m0, m1 + punpcklbw m1, m2 + pmaddubsw m0, m3 + pmaddubsw m1, m3 + psraw m0, 2 + psraw m1, 2 + pavgw m0, m4 + pavgw m1, m4 +%if mmsize==8 + packuswb m0, m0 + packuswb m1, m1 + movh [dstq+dststrideq*0], m0 + movh [dstq+dststrideq*1], m1 +%else + packuswb m0, m1 + movh [dstq+dststrideq*0], m0 + movhps [dstq+dststrideq*1], m0 +%endif + + lea dstq, [dstq+dststrideq*2] + lea srcq, [srcq+srcstrideq*2] + sub heightd, 2 + jg .nextrow + REP_RET + +cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 5, dst, dststride, src, srcstride, height, mx, picreg + shl mxd, 4 +%ifdef PIC + lea picregq, [bilinear_filter_vb_m] +%endif + pxor m4, m4 + mova m2, [filter_h2_shuf] + mova m3, [bilinear_filter_vb+mxq-16] +.nextrow: + movu m0, [srcq+srcstrideq*0] + movu m1, [srcq+srcstrideq*1] + pshufb m0, m2 + pshufb m1, m2 + pmaddubsw m0, m3 + pmaddubsw m1, m3 + psraw m0, 2 + psraw m1, 2 + pavgw m0, m4 + pavgw m1, m4 +%if mmsize==8 + packuswb m0, m0 + packuswb m1, m1 + movh [dstq+dststrideq*0], m0 + movh [dstq+dststrideq*1], m1 +%else + packuswb m0, m1 + movh [dstq+dststrideq*0], m0 + movhps [dstq+dststrideq*1], m0 +%endif + + lea dstq, [dstq+dststrideq*2] + lea srcq, [srcq+srcstrideq*2] + sub heightd, 2 + jg .nextrow + REP_RET +%endmacro + INIT_MMX ssse3 -FILTER_BILINEAR 4 +FILTER_BILINEAR_SSSE3 4 INIT_XMM ssse3 -FILTER_BILINEAR 8 +FILTER_BILINEAR_SSSE3 8 INIT_MMX mmx cglobal put_vp8_pixels8, 5, 5, 0, dst, dststride, src, srcstride, height |