static void register_all(void) { /* 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_NVDEC, h264_nvdec); REGISTER_HWACCEL(H264_QSV, h264_qsv); REGISTER_HWACCEL(H264_VAAPI, h264_vaapi); 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_NVDEC, hevc_nvdec); 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_NVDEC, vc1_nvdec); 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_NVDEC, vp9_nvdec); 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_NVDEC, wmv3_nvdec); 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_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_ENCDEC (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); 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); REGISTER_DECODER(MPEGVIDEO, mpegvideo); 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); 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); 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_ENCDEC (APTX, aptx); 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(HEVC_VIDEOTOOLBOX, hevc_videotoolbox); REGISTER_ENCODER(LIBKVAZAAR, libkvazaar); REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid); REGISTER_ENCODER(MJPEG_QSV, mjpeg_qsv); 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); }


void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr) { uint64_t old_mask = env->psw.mask; env->psw.addr = addr; env->psw.mask = mask; if (tcg_enabled()) { env->cc_op = (mask >> 44) & 3; } if ((old_mask ^ mask) & PSW_MASK_PER) { s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env))); } if (mask & PSW_MASK_WAIT) { S390CPU *cpu = s390_env_get_cpu(env); if (s390_cpu_halt(cpu) == 0) { #ifndef CONFIG_USER_ONLY qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); #endif } } }


static int amr_read_packet(AVFormatContext *s, AVPacket *pkt) { AVCodecContext *enc = s->streams[0]->codec; int read, size = 0, toc, mode; int64_t pos = avio_tell(s->pb); if (url_feof(s->pb)) { return AVERROR(EIO); } // FIXME this is wrong, this should rather be in a AVParset toc = avio_r8(s->pb); mode = (toc >> 3) & 0x0F; if (enc->codec_id == AV_CODEC_ID_AMR_NB) { static const uint8_t packed_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; size = packed_size[mode] + 1; } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) { static const uint8_t packed_size[16] = { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 }; size = packed_size[mode]; } else { av_assert0(0); } if (!size || av_new_packet(pkt, size)) return AVERROR(EIO); /* Both AMR formats have 50 frames per second */ s->streams[0]->codec->bit_rate = size*8*50; pkt->stream_index = 0; pkt->pos = pos; pkt->data[0] = toc; pkt->duration = enc->codec_id == AV_CODEC_ID_AMR_NB ? 160 : 320; read = avio_read(s->pb, pkt->data + 1, size - 1); if (read != size - 1) { av_free_packet(pkt); return AVERROR(EIO); } return 0; }


static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size) { uint8_t *buf1; RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; StreamInfo *stream = rm->audio_stream; int i; /* XXX: suppress this malloc */ buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) ); write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame); /* for AC3, the words seems to be reversed */ for(i=0;i<size;i+=2) { buf1[i] = buf[i+1]; buf1[i+1] = buf[i]; } put_buffer(pb, buf1, size); put_flush_packet(pb); stream->nb_frames++; av_free(buf1); return 0; }


static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); #else int i; for (i=0; i<width; i++) { int b= src[i*3+0]; int g= src[i*3+1]; int r= src[i*3+2]; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); } #endif /* COMPILE_TEMPLATE_MMX */ }


void ff_put_h264_qpel8_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_8w_msa(src - 2, stride, dst, stride, 8, 1); }


static int bmp_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; BMPContext *s = avctx->priv_data; AVFrame *picture = data; AVFrame *p = &s->picture; unsigned int fsize, hsize; int width, height; unsigned int depth; BiCompression comp; unsigned int ihsize; int i, j, n, linesize; uint32_t rgb[3]; uint8_t *ptr; int dsize; const uint8_t *buf0 = buf; if(buf_size < 14){ av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size); return -1; } if(bytestream_get_byte(&buf) != 'B' || bytestream_get_byte(&buf) != 'M') { av_log(avctx, AV_LOG_ERROR, "bad magic number\n"); return -1; } fsize = bytestream_get_le32(&buf); if(buf_size < fsize){ av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d), trying to decode anyway\n", buf_size, fsize); fsize = buf_size; } buf += 2; /* reserved1 */ buf += 2; /* reserved2 */ hsize = bytestream_get_le32(&buf); /* header size */ ihsize = bytestream_get_le32(&buf); /* more header size */ if(ihsize + 14 > hsize){ av_log(avctx, AV_LOG_ERROR, "invalid header size %d\n", hsize); return -1; } /* sometimes file size is set to some headers size, set a real size in that case */ if(fsize == 14 || fsize == ihsize + 14) fsize = buf_size - 2; if(fsize <= hsize){ av_log(avctx, AV_LOG_ERROR, "declared file size is less than header size (%d < %d)\n", fsize, hsize); return -1; } switch(ihsize){ case 40: // windib v3 case 64: // OS/2 v2 case 108: // windib v4 case 124: // windib v5 width = bytestream_get_le32(&buf); height = bytestream_get_le32(&buf); break; case 12: // OS/2 v1 width = bytestream_get_le16(&buf); height = bytestream_get_le16(&buf); break; default: av_log(avctx, AV_LOG_ERROR, "unsupported BMP file, patch welcome\n"); return -1; } if(bytestream_get_le16(&buf) != 1){ /* planes */ av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n"); return -1; } depth = bytestream_get_le16(&buf); if(ihsize == 40) comp = bytestream_get_le32(&buf); else comp = BMP_RGB; if(comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 && comp != BMP_RLE8){ av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp); return -1; } if(comp == BMP_BITFIELDS){ buf += 20; rgb[0] = bytestream_get_le32(&buf); rgb[1] = bytestream_get_le32(&buf); rgb[2] = bytestream_get_le32(&buf); } avctx->width = width; avctx->height = height > 0? height: -height; avctx->pix_fmt = PIX_FMT_NONE; switch(depth){ case 32: if(comp == BMP_BITFIELDS){ rgb[0] = (rgb[0] >> 15) & 3; rgb[1] = (rgb[1] >> 15) & 3; rgb[2] = (rgb[2] >> 15) & 3; if(rgb[0] + rgb[1] + rgb[2] != 3 || rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]){ break; } } else { rgb[0] = 2; rgb[1] = 1; rgb[2] = 0; } avctx->pix_fmt = PIX_FMT_BGR24; break; case 24: avctx->pix_fmt = PIX_FMT_BGR24; break; case 16: if(comp == BMP_RGB) avctx->pix_fmt = PIX_FMT_RGB555; if(comp == BMP_BITFIELDS) avctx->pix_fmt = rgb[1] == 0x07E0 ? PIX_FMT_RGB565 : PIX_FMT_RGB555; break; case 8: if(hsize - ihsize - 14 > 0) avctx->pix_fmt = PIX_FMT_PAL8; else avctx->pix_fmt = PIX_FMT_GRAY8; break; case 1: case 4: if(hsize - ihsize - 14 > 0){ avctx->pix_fmt = PIX_FMT_PAL8; }else{ av_log(avctx, AV_LOG_ERROR, "Unknown palette for %d-colour BMP\n", 1<<depth); return -1; } break; default: av_log(avctx, AV_LOG_ERROR, "depth %d not supported\n", depth); return -1; } if(avctx->pix_fmt == PIX_FMT_NONE){ av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if(p->data[0]) avctx->release_buffer(avctx, p); p->reference = 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; buf = buf0 + hsize; dsize = buf_size - hsize; /* Line size in file multiple of 4 */ n = ((avctx->width * depth) / 8 + 3) & ~3; if(n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8){ av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n", dsize, n * avctx->height); return -1; } // RLE may skip decoding some picture areas, so blank picture before decoding if(comp == BMP_RLE4 || comp == BMP_RLE8) memset(p->data[0], 0, avctx->height * p->linesize[0]); if(depth == 4 || depth == 8) memset(p->data[1], 0, 1024); if(height > 0){ ptr = p->data[0] + (avctx->height - 1) * p->linesize[0]; linesize = -p->linesize[0]; } else { ptr = p->data[0]; linesize = p->linesize[0]; } if(avctx->pix_fmt == PIX_FMT_PAL8){ int colors = 1 << depth; if(ihsize >= 36){ int t; buf = buf0 + 46; t = bytestream_get_le32(&buf); if(t < 0 || t > (1 << depth)){ av_log(avctx, AV_LOG_ERROR, "Incorrect number of colors - %X for bitdepth %d\n", t, depth); }else if(t){ colors = t; } } buf = buf0 + 14 + ihsize; //palette location if((hsize-ihsize-14) < (colors << 2)){ // OS/2 bitmap, 3 bytes per palette entry for(i = 0; i < colors; i++) ((uint32_t*)p->data[1])[i] = bytestream_get_le24(&buf); }else{ for(i = 0; i < colors; i++) ((uint32_t*)p->data[1])[i] = bytestream_get_le32(&buf); } buf = buf0 + hsize; } if(comp == BMP_RLE4 || comp == BMP_RLE8){ if(height < 0){ p->data[0] += p->linesize[0] * (avctx->height - 1); p->linesize[0] = -p->linesize[0]; } ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize); if(height < 0){ p->data[0] += p->linesize[0] * (avctx->height - 1); p->linesize[0] = -p->linesize[0]; } }else{ switch(depth){ case 1: for (i = 0; i < avctx->height; i++) { int j; for (j = 0; j < n; j++) { ptr[j*8+0] = buf[j] >> 7; ptr[j*8+1] = (buf[j] >> 6) & 1; ptr[j*8+2] = (buf[j] >> 5) & 1; ptr[j*8+3] = (buf[j] >> 4) & 1; ptr[j*8+4] = (buf[j] >> 3) & 1; ptr[j*8+5] = (buf[j] >> 2) & 1; ptr[j*8+6] = (buf[j] >> 1) & 1; ptr[j*8+7] = buf[j] & 1; } buf += n; ptr += linesize; } break; case 8: case 24: for(i = 0; i < avctx->height; i++){ memcpy(ptr, buf, n); buf += n; ptr += linesize; } break; case 4: for(i = 0; i < avctx->height; i++){ int j; for(j = 0; j < n; j++){ ptr[j*2+0] = (buf[j] >> 4) & 0xF; ptr[j*2+1] = buf[j] & 0xF; } buf += n; ptr += linesize; } break; case 16: for(i = 0; i < avctx->height; i++){ const uint16_t *src = (const uint16_t *) buf; uint16_t *dst = (uint16_t *) ptr; for(j = 0; j < avctx->width; j++) *dst++ = av_le2ne16(*src++); buf += n; ptr += linesize; } break; case 32: for(i = 0; i < avctx->height; i++){ const uint8_t *src = buf; uint8_t *dst = ptr; for(j = 0; j < avctx->width; j++){ dst[0] = src[rgb[2]]; dst[1] = src[rgb[1]]; dst[2] = src[rgb[0]]; dst += 3; src += 4; } buf += n; ptr += linesize; } break; default: av_log(avctx, AV_LOG_ERROR, "BMP decoder is broken\n"); return -1; } } *picture = s->picture; *data_size = sizeof(AVPicture); return buf_size; }


static int pcm_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size, bps; // AVStream *st = s->streams[0]; size= RAW_SAMPLES*s->streams[0]->codec->block_align; ret= av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; if (ret < 0) return ret; bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id); assert(bps); // if false there IS a bug elsewhere (NOT in this function) pkt->dts= pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels); return ret; }


static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { char buf[256]; int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); char *separator = ic->dump_separator; char **codec_separator = av_opt_ptr(st->codec->av_class, st->codec, "dump_separator"); int use_format_separator = !*codec_separator; if (use_format_separator) *codec_separator = av_strdup(separator); avcodec_string(buf, sizeof(buf), st->codec, is_output); if (use_format_separator) av_freep(codec_separator); av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); /* the pid is an important information, so we display it */ /* XXX: add a generic system */ if (flags & AVFMT_SHOW_IDS) av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id); if (lang) av_log(NULL, AV_LOG_INFO, "(%s)", lang->value); av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num, st->time_base.den); av_log(NULL, AV_LOG_INFO, ": %s", buf); if (st->sample_aspect_ratio.num && // default av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { AVRational display_aspect_ratio; av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, st->codec->width * st->sample_aspect_ratio.num, st->codec->height * st->sample_aspect_ratio.den, 1024 * 1024); av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; int tbr = st->r_frame_rate.den && st->r_frame_rate.num; int tbn = st->time_base.den && st->time_base.num; int tbc = st->codec->time_base.den && st->codec->time_base.num; if (fps || tbr || tbn || tbc) av_log(NULL, AV_LOG_INFO, "%s", separator); if (fps) print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps"); if (tbr) print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr"); if (tbn) print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn"); if (tbc) print_fps(1 / av_q2d(st->codec->time_base), "tbc"); } if (st->disposition & AV_DISPOSITION_DEFAULT) av_log(NULL, AV_LOG_INFO, " (default)"); if (st->disposition & AV_DISPOSITION_DUB) av_log(NULL, AV_LOG_INFO, " (dub)"); if (st->disposition & AV_DISPOSITION_ORIGINAL) av_log(NULL, AV_LOG_INFO, " (original)"); if (st->disposition & AV_DISPOSITION_COMMENT) av_log(NULL, AV_LOG_INFO, " (comment)"); if (st->disposition & AV_DISPOSITION_LYRICS) av_log(NULL, AV_LOG_INFO, " (lyrics)"); if (st->disposition & AV_DISPOSITION_KARAOKE) av_log(NULL, AV_LOG_INFO, " (karaoke)"); if (st->disposition & AV_DISPOSITION_FORCED) av_log(NULL, AV_LOG_INFO, " (forced)"); if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (visual impaired)"); if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); dump_sidedata(NULL, st, " "); }


static av_cold int encode_close(AVCodecContext *avctx) { if (avctx->priv_data) { DCAEncContext *c = avctx->priv_data; subband_bufer_free(c); ff_dcaadpcm_free(&c->adpcm_ctx); } return 0; }


static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { int async_ret; BlockDriverAIOCB *acb; async_ret = NOT_DONE; qemu_aio_wait_start(); acb = bdrv_aio_read(bs, sector_num, buf, nb_sectors, bdrv_rw_em_cb, &async_ret); if (acb == NULL) { qemu_aio_wait_end(); return -1; } while (async_ret == NOT_DONE) { qemu_aio_wait(); } qemu_aio_wait_end(); return async_ret; }


void hmp_info_cpus(Monitor *mon, const QDict *qdict) { CpuInfoList *cpu_list, *cpu; cpu_list = qmp_query_cpus(NULL); for (cpu = cpu_list; cpu; cpu = cpu->next) { int active = ' '; if (cpu->value->CPU == monitor_get_cpu_index()) { active = '*'; } monitor_printf(mon, "%c CPU #%" PRId64 ":", active, cpu->value->CPU); switch (cpu->value->arch) { case CPU_INFO_ARCH_X86: monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.x86->pc); break; case CPU_INFO_ARCH_PPC: monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->u.ppc->nip); break; case CPU_INFO_ARCH_SPARC: monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.q_sparc->pc); monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.q_sparc->npc); break; case CPU_INFO_ARCH_MIPS: monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.q_mips->PC); break; case CPU_INFO_ARCH_TRICORE: monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC); break; default: break; } if (cpu->value->halted) { monitor_printf(mon, " (halted)"); } monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id); } qapi_free_CpuInfoList(cpu_list); }


MemTxResult memory_region_dispatch_write(MemoryRegion *mr, hwaddr addr, uint64_t data, unsigned size, MemTxAttrs attrs) { if (!memory_region_access_valid(mr, addr, size, true)) { unassigned_mem_write(mr, addr, data, size); return MEMTX_DECODE_ERROR; adjust_endianness(mr, &data, size); if (mr->ops->write) { return access_with_adjusted_size(addr, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_accessor, mr, attrs); } else if (mr->ops->write_with_attrs) { return access_with_adjusted_size(addr, &data, size, mr->ops->impl.min_access_size, mr->ops->impl.max_access_size, memory_region_write_with_attrs_accessor, mr, attrs); } else { return access_with_adjusted_size(addr, &data, size, 1, 4, memory_region_oldmmio_write_accessor, mr, attrs);


static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type) { H264Context *h = &svq3->h; int i, j, k, m, dir, mode; int cbp = 0; uint32_t vlc; int8_t *top, *left; MpegEncContext *const s = (MpegEncContext *) h; const int mb_xy = h->mb_xy; const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; h->topright_samples_available = 0xFFFF; if (mb_type == 0) { /* SKIP */ if (s->pict_type == AV_PICTURE_TYPE_P || s->next_picture.f.mb_type[mb_xy] == -1) { svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0); if (s->pict_type == AV_PICTURE_TYPE_B) { svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1); } mb_type = MB_TYPE_SKIP; } else { mb_type = FFMIN(s->next_picture.f.mb_type[mb_xy], 6); if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0) return -1; if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0) return -1; mb_type = MB_TYPE_16x16; } } else if (mb_type < 8) { /* INTER */ if (svq3->thirdpel_flag && svq3->halfpel_flag == !get_bits1 (&s->gb)) { mode = THIRDPEL_MODE; } else if (svq3->halfpel_flag && svq3->thirdpel_flag == !get_bits1 (&s->gb)) { mode = HALFPEL_MODE; } else { mode = FULLPEL_MODE; } /* fill caches */ /* note ref_cache should contain here: ???????? ???11111 N??11111 N??11111 N??11111 */ for (m = 0; m < 2; m++) { if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) { for (i = 0; i < 4; i++) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - 1 + i*h->b_stride]; } } else { for (i = 0; i < 4; i++) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0; } } if (s->mb_y > 0) { memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t)); memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4); if (s->mb_x < (s->mb_width - 1)) { *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4]; h->ref_cache[m][scan8[0] + 4 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 || h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1; }else h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE; if (s->mb_x > 0) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1]; h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1; }else h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE; }else memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); if (s->pict_type != AV_PICTURE_TYPE_B) break; } /* decode motion vector(s) and form prediction(s) */ if (s->pict_type == AV_PICTURE_TYPE_P) { if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0) return -1; } else { /* AV_PICTURE_TYPE_B */ if (mb_type != 2) { if (svq3_mc_dir(h, 0, mode, 0, 0) < 0) return -1; } else { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } if (mb_type != 1) { if (svq3_mc_dir(h, 0, mode, 1, (mb_type == 3)) < 0) return -1; } else { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } } mb_type = MB_TYPE_16x16; } else if (mb_type == 8 || mb_type == 33) { /* INTRA4x4 */ memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t)); if (mb_type == 8) { if (s->mb_x > 0) { for (i = 0; i < 4; i++) { h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i]; } if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) { h->left_samples_available = 0x5F5F; } } if (s->mb_y > 0) { h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+0]; h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+1]; h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+2]; h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+3]; if (h->intra4x4_pred_mode_cache[4+8*0] == -1) { h->top_samples_available = 0x33FF; } } /* decode prediction codes for luma blocks */ for (i = 0; i < 16; i+=2) { vlc = svq3_get_ue_golomb(&s->gb); if (vlc >= 25){ av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc); return -1; } left = &h->intra4x4_pred_mode_cache[scan8[i] - 1]; top = &h->intra4x4_pred_mode_cache[scan8[i] - 8]; left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]]; left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]]; if (left[1] == -1 || left[2] == -1){ av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n"); return -1; } } } else { /* mb_type == 33, DC_128_PRED block type */ for (i = 0; i < 4; i++) { memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4); } } write_back_intra_pred_mode(h); if (mb_type == 8) { ff_h264_check_intra4x4_pred_mode(h); h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; } else { for (i = 0; i < 4; i++) { memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4); } h->top_samples_available = 0x33FF; h->left_samples_available = 0x5F5F; } mb_type = MB_TYPE_INTRA4x4; } else { /* INTRA16x16 */ dir = i_mb_type_info[mb_type - 8].pred_mode; dir = (dir >> 1) ^ 3*(dir & 1) ^ 1; if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir)) == -1){ av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n"); return -1; } cbp = i_mb_type_info[mb_type - 8].cbp; mb_type = MB_TYPE_INTRA16x16; } if (!IS_INTER(mb_type) && s->pict_type != AV_PICTURE_TYPE_I) { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } if (s->pict_type == AV_PICTURE_TYPE_B) { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } } if (!IS_INTRA4x4(mb_type)) { memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8); } if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) { memset(h->non_zero_count_cache + 8, 0, 14*8*sizeof(uint8_t)); s->dsp.clear_blocks(h->mb+ 0); s->dsp.clear_blocks(h->mb+384); } if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) { if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); return -1; } cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; } if (IS_INTRA16x16(mb_type) || (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) { s->qscale += svq3_get_se_golomb(&s->gb); if (s->qscale > 31){ av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale); return -1; } } if (IS_INTRA16x16(mb_type)) { AV_ZERO128(h->mb_luma_dc[0]+0); AV_ZERO128(h->mb_luma_dc[0]+8); if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n"); return -1; } } if (cbp) { const int index = IS_INTRA16x16(mb_type) ? 1 : 0; const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1); for (i = 0; i < 4; i++) { if ((cbp & (1 << i))) { for (j = 0; j < 4; j++) { k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j); h->non_zero_count_cache[ scan8[k] ] = 1; if (svq3_decode_block(&s->gb, &h->mb[16*k], index, type)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n"); return -1; } } } } if ((cbp & 0x30)) { for (i = 1; i < 3; ++i) { if (svq3_decode_block(&s->gb, &h->mb[16*16*i], 0, 3)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); return -1; } } if ((cbp & 0x20)) { for (i = 1; i < 3; i++) { for (j = 0; j < 4; j++) { k = 16*i + j; h->non_zero_count_cache[ scan8[k] ] = 1; if (svq3_decode_block(&s->gb, &h->mb[16*k], 1, 1)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n"); return -1; } } } } } } h->cbp= cbp; s->current_picture.f.mb_type[mb_xy] = mb_type; if (IS_INTRA(mb_type)) { h->chroma_pred_mode = ff_h264_check_intra_pred_mode(h, DC_PRED8x8); } return 0; }


static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet) { MpegEncContext *s = avctx->priv_data; AVFrame *pic; int i, ret; int chroma_h_shift, chroma_v_shift; av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); //CODEC_FLAG_EMU_EDGE have to be cleared if(s->avctx->flags & CODEC_FLAG_EMU_EDGE) return AVERROR(EINVAL); pic = av_frame_alloc(); if (!pic) return AVERROR(ENOMEM); av_frame_ref(pic, pic_arg); //picture should be flipped upside-down for(i=0; i < 3; i++) { int vsample = i ? 2 >> chroma_v_shift : 2; pic->data[i] += (pic->linesize[i] * (vsample * (8 * s->mb_height -((s->height/V_MAX)&7)) - 1 )); pic->linesize[i] *= -1; } ret = ff_MPV_encode_picture(avctx, pkt, pic, got_packet); av_frame_free(&pic); return ret; }


static int mpeg1_decode_sequence(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; int width, height; int i, v, j; init_get_bits(&s->gb, buf, buf_size * 8); width = get_bits(&s->gb, 12); height = get_bits(&s->gb, 12); if (width == 0 || height == 0) { av_log(avctx, AV_LOG_WARNING, "Invalid horizontal or vertical size value.\n"); if (avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_COMPLIANT)) return AVERROR_INVALIDDATA; } s->aspect_ratio_info = get_bits(&s->gb, 4); if (s->aspect_ratio_info == 0) { av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n"); if (avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_COMPLIANT)) return AVERROR_INVALIDDATA; } s->frame_rate_index = get_bits(&s->gb, 4); if (s->frame_rate_index == 0 || s->frame_rate_index > 13) { av_log(avctx, AV_LOG_WARNING, "frame_rate_index %d is invalid\n", s->frame_rate_index); s->frame_rate_index = 1; } s->bit_rate = get_bits(&s->gb, 18) * 400; if (get_bits1(&s->gb) == 0) { /* marker */ av_log(avctx, AV_LOG_ERROR, "Marker in sequence header missing\n"); return AVERROR_INVALIDDATA; } s->width = width; s->height = height; s->avctx->rc_buffer_size = get_bits(&s->gb, 10) * 1024 * 16; skip_bits(&s->gb, 1); /* get matrix */ if (get_bits1(&s->gb)) { load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1); } else { for (i = 0; i < 64; i++) { j = s->idsp.idct_permutation[i]; v = ff_mpeg1_default_intra_matrix[i]; s->intra_matrix[j] = v; s->chroma_intra_matrix[j] = v; } } if (get_bits1(&s->gb)) { load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0); } else { for (i = 0; i < 64; i++) { int j = s->idsp.idct_permutation[i]; v = ff_mpeg1_default_non_intra_matrix[i]; s->inter_matrix[j] = v; s->chroma_inter_matrix[j] = v; } } if (show_bits(&s->gb, 23) != 0) { av_log(s->avctx, AV_LOG_ERROR, "sequence header damaged\n"); return AVERROR_INVALIDDATA; } /* We set MPEG-2 parameters so that it emulates MPEG-1. */ s->progressive_sequence = 1; s->progressive_frame = 1; s->picture_structure = PICT_FRAME; s->first_field = 0; s->frame_pred_frame_dct = 1; s->chroma_format = 1; s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; s->out_format = FMT_MPEG1; s->swap_uv = 0; // AFAIK VCR2 does not have SEQ_HEADER if (s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%d, aspect_ratio_info: %d \n", s->avctx->rc_buffer_size, s->bit_rate, s->aspect_ratio_info); return 0; }


static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, uint32_t code_prefix, int n_prefix) { int i, j, k, n, table_size, table_index, nb, n1, index; uint32_t code; VLC_TYPE (*table)[2]; table_size = 1 << table_nb_bits; table_index = alloc_table(vlc, table_size); #ifdef DEBUG_VLC printf("new table index=%d size=%d code_prefix=%x n=%d\n", table_index, table_size, code_prefix, n_prefix); #endif if (table_index < 0) return -1; table = &vlc->table[table_index]; for(i=0;i<table_size;i++) { table[i][1] = 0; //bits table[i][0] = -1; //codes } /* first pass: map codes and compute auxillary table sizes */ for(i=0;i<nb_codes;i++) { GET_DATA(n, bits, i, bits_wrap, bits_size); GET_DATA(code, codes, i, codes_wrap, codes_size); /* we accept tables with holes */ if (n <= 0) continue; #if defined(DEBUG_VLC) && 0 printf("i=%d n=%d code=0x%x\n", i, n, code); #endif /* if code matches the prefix, it is in the table */ n -= n_prefix; if (n > 0 && (code >> n) == code_prefix) { if (n <= table_nb_bits) { /* no need to add another table */ j = (code << (table_nb_bits - n)) & (table_size - 1); nb = 1 << (table_nb_bits - n); for(k=0;k<nb;k++) { #ifdef DEBUG_VLC av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", j, i, n); #endif if (table[j][1] /*bits*/ != 0) { av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); return -1; } table[j][1] = n; //bits table[j][0] = i; //code j++; } } else { n -= table_nb_bits; j = (code >> n) & ((1 << table_nb_bits) - 1); #ifdef DEBUG_VLC printf("%4x: n=%d (subtable)\n", j, n); #endif /* compute table size */ n1 = -table[j][1]; //bits if (n > n1) n1 = n; table[j][1] = -n1; //bits } } } /* second pass : fill auxillary tables recursively */ for(i=0;i<table_size;i++) { n = table[i][1]; //bits if (n < 0) { n = -n; if (n > table_nb_bits) { n = table_nb_bits; table[i][1] = -n; //bits } index = build_table(vlc, n, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, (code_prefix << table_nb_bits) | i, n_prefix + table_nb_bits); if (index < 0) return -1; /* note: realloc has been done, so reload tables */ table = &vlc->table[table_index]; table[i][0] = index; //code } } return table_index; }


av_cold static int lavfi_read_header(AVFormatContext *avctx) { LavfiContext *lavfi = avctx->priv_data; AVFilterInOut *input_links = NULL, *output_links = NULL, *inout; AVFilter *buffersink, *abuffersink; int *pix_fmts = create_all_formats(AV_PIX_FMT_NB); enum AVMediaType type; int ret = 0, i, n; #define FAIL(ERR) { ret = ERR; goto end; } if (!pix_fmts) FAIL(AVERROR(ENOMEM)); avfilter_register_all(); buffersink = avfilter_get_by_name("ffbuffersink"); abuffersink = avfilter_get_by_name("ffabuffersink"); if (lavfi->graph_filename && lavfi->graph_str) { av_log(avctx, AV_LOG_ERROR, "Only one of the graph or graph_file options must be specified\n"); return AVERROR(EINVAL); } if (lavfi->graph_filename) { uint8_t *file_buf, *graph_buf; size_t file_bufsize; ret = av_file_map(lavfi->graph_filename, &file_buf, &file_bufsize, 0, avctx); if (ret < 0) return ret; /* create a 0-terminated string based on the read file */ graph_buf = av_malloc(file_bufsize + 1); if (!graph_buf) { av_file_unmap(file_buf, file_bufsize); return AVERROR(ENOMEM); } memcpy(graph_buf, file_buf, file_bufsize); graph_buf[file_bufsize] = 0; av_file_unmap(file_buf, file_bufsize); lavfi->graph_str = graph_buf; } if (!lavfi->graph_str) lavfi->graph_str = av_strdup(avctx->filename); /* parse the graph, create a stream for each open output */ if (!(lavfi->graph = avfilter_graph_alloc())) FAIL(AVERROR(ENOMEM)); if ((ret = avfilter_graph_parse(lavfi->graph, lavfi->graph_str, &input_links, &output_links, avctx)) < 0) FAIL(ret); if (input_links) { av_log(avctx, AV_LOG_ERROR, "Open inputs in the filtergraph are not acceptable\n"); FAIL(AVERROR(EINVAL)); } /* count the outputs */ for (n = 0, inout = output_links; inout; n++, inout = inout->next); if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n))) FAIL(AVERROR(ENOMEM)); if (!(lavfi->sink_eof = av_mallocz(sizeof(int) * n))) FAIL(AVERROR(ENOMEM)); if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n))) FAIL(AVERROR(ENOMEM)); for (i = 0; i < n; i++) lavfi->stream_sink_map[i] = -1; /* parse the output link names - they need to be of the form out0, out1, ... * create a mapping between them and the streams */ for (i = 0, inout = output_links; inout; i++, inout = inout->next) { int stream_idx; if (!strcmp(inout->name, "out")) stream_idx = 0; else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) { av_log(avctx, AV_LOG_ERROR, "Invalid outpad name '%s'\n", inout->name); FAIL(AVERROR(EINVAL)); } if ((unsigned)stream_idx >= n) { av_log(avctx, AV_LOG_ERROR, "Invalid index was specified in output '%s', " "must be a non-negative value < %d\n", inout->name, n); FAIL(AVERROR(EINVAL)); } /* is an audio or video output? */ type = inout->filter_ctx->output_pads[inout->pad_idx].type; if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) { av_log(avctx, AV_LOG_ERROR, "Output '%s' is not a video or audio output, not yet supported\n", inout->name); FAIL(AVERROR(EINVAL)); } if (lavfi->stream_sink_map[stream_idx] != -1) { av_log(avctx, AV_LOG_ERROR, "An output with stream index %d was already specified\n", stream_idx); FAIL(AVERROR(EINVAL)); } lavfi->sink_stream_map[i] = stream_idx; lavfi->stream_sink_map[stream_idx] = i; } /* for each open output create a corresponding stream */ for (i = 0, inout = output_links; inout; i++, inout = inout->next) { AVStream *st; if (!(st = avformat_new_stream(avctx, NULL))) FAIL(AVERROR(ENOMEM)); st->id = i; } /* create a sink for each output and connect them to the graph */ lavfi->sinks = av_malloc(sizeof(AVFilterContext *) * avctx->nb_streams); if (!lavfi->sinks) FAIL(AVERROR(ENOMEM)); for (i = 0, inout = output_links; inout; i++, inout = inout->next) { AVFilterContext *sink; type = inout->filter_ctx->output_pads[inout->pad_idx].type; if (type == AVMEDIA_TYPE_VIDEO && ! buffersink || type == AVMEDIA_TYPE_AUDIO && ! abuffersink) { av_log(avctx, AV_LOG_ERROR, "Missing required buffersink filter, aborting.\n"); FAIL(AVERROR_FILTER_NOT_FOUND); } if (type == AVMEDIA_TYPE_VIDEO) { AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); buffersink_params->pixel_fmts = pix_fmts; ret = avfilter_graph_create_filter(&sink, buffersink, inout->name, NULL, buffersink_params, lavfi->graph); av_freep(&buffersink_params); if (ret < 0) goto end; } else if (type == AVMEDIA_TYPE_AUDIO) { enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL, -1 }; AVABufferSinkParams *abuffersink_params = av_abuffersink_params_alloc(); abuffersink_params->sample_fmts = sample_fmts; ret = avfilter_graph_create_filter(&sink, abuffersink, inout->name, NULL, abuffersink_params, lavfi->graph); av_free(abuffersink_params); if (ret < 0) goto end; } lavfi->sinks[i] = sink; if ((ret = avfilter_link(inout->filter_ctx, inout->pad_idx, sink, 0)) < 0) FAIL(ret); } /* configure the graph */ if ((ret = avfilter_graph_config(lavfi->graph, avctx)) < 0) FAIL(ret); if (lavfi->dump_graph) { char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph); fputs(dump, stderr); fflush(stderr); av_free(dump); } /* fill each stream with the information in the corresponding sink */ for (i = 0; i < avctx->nb_streams; i++) { AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0]; AVStream *st = avctx->streams[i]; st->codec->codec_type = link->type; avpriv_set_pts_info(st, 64, link->time_base.num, link->time_base.den); if (link->type == AVMEDIA_TYPE_VIDEO) { st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; st->codec->pix_fmt = link->format; st->codec->time_base = link->time_base; st->codec->width = link->w; st->codec->height = link->h; st ->sample_aspect_ratio = st->codec->sample_aspect_ratio = link->sample_aspect_ratio; } else if (link->type == AVMEDIA_TYPE_AUDIO) { st->codec->codec_id = av_get_pcm_codec(link->format, -1); st->codec->channels = av_get_channel_layout_nb_channels(link->channel_layout); st->codec->sample_fmt = link->format; st->codec->sample_rate = link->sample_rate; st->codec->time_base = link->time_base; st->codec->channel_layout = link->channel_layout; if (st->codec->codec_id == AV_CODEC_ID_NONE) av_log(avctx, AV_LOG_ERROR, "Could not find PCM codec for sample format %s.\n", av_get_sample_fmt_name(link->format)); } } end: av_free(pix_fmts); avfilter_inout_free(&input_links); avfilter_inout_free(&output_links); if (ret < 0) lavfi_read_close(avctx); return ret; }


static gboolean register_signal_handlers(void) { struct sigaction sigact, sigact_chld; int ret; memset(&sigact, 0, sizeof(struct sigaction)); sigact.sa_handler = quit_handler; ret = sigaction(SIGINT, &sigact, NULL); if (ret == -1) { g_error("error configuring signal handler: %s", strerror(errno)); return false; } ret = sigaction(SIGTERM, &sigact, NULL); if (ret == -1) { g_error("error configuring signal handler: %s", strerror(errno)); return false; } memset(&sigact_chld, 0, sizeof(struct sigaction)); sigact_chld.sa_handler = child_handler; sigact_chld.sa_flags = SA_NOCLDSTOP; ret = sigaction(SIGCHLD, &sigact_chld, NULL); if (ret == -1) { g_error("error configuring signal handler: %s", strerror(errno)); } return true; }


static void sch_handle_start_func_virtual(SubchDev *sch) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int path; int ret; bool suspend_allowed; /* Path management: In our simple css, we always choose the only path. */ path = 0x80; if (!(s->ctrl & SCSW_ACTL_SUSP)) { /* Start Function triggered via ssch, i.e. we have an ORB */ ORB *orb = &sch->orb; s->cstat = 0; s->dstat = 0; /* Look at the orb and try to execute the channel program. */ p->intparm = orb->intparm; if (!(orb->lpm & path)) { /* Generate a deferred cc 3 condition. */ s->flags |= SCSW_FLAGS_MASK_CC; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND); return; } sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT); s->flags |= (sch->ccw_fmt_1) ? SCSW_FLAGS_MASK_FMT : 0; sch->ccw_no_data_cnt = 0; suspend_allowed = !!(orb->ctrl0 & ORB_CTRL0_MASK_SPND); } else { /* Start Function resumed via rsch */ s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); /* The channel program had been suspended before. */ suspend_allowed = true; } sch->last_cmd_valid = false; do { ret = css_interpret_ccw(sch, sch->channel_prog, suspend_allowed); switch (ret) { case -EAGAIN: /* ccw chain, continue processing */ break; case 0: /* success */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_STATUS_PEND; s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END; s->cpa = sch->channel_prog + 8; break; case -EIO: /* I/O errors, status depends on specific devices */ break; case -ENOSYS: /* unsupported command, generate unit check (command reject) */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->dstat = SCSW_DSTAT_UNIT_CHECK; /* Set sense bit 0 in ecw0. */ sch->sense_data[0] = 0x80; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EFAULT: /* memory problem, generate channel data check */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_DATA_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EBUSY: /* subchannel busy, generate deferred cc 1 */ s->flags &= ~SCSW_FLAGS_MASK_CC; s->flags |= (1 << 8); s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; break; case -EINPROGRESS: /* channel program has been suspended */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl |= SCSW_ACTL_SUSP; break; default: /* error, generate channel program check */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_PROG_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; } } while (ret == -EAGAIN); }


static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples) { AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; ShowWavesContext *showwaves = ctx->priv; const int nb_samples = insamples->audio->nb_samples; AVFilterBufferRef *outpicref = showwaves->outpicref; int linesize = outpicref ? outpicref->linesize[0] : 0; int16_t *p = (int16_t *)insamples->data[0]; int nb_channels = av_get_channel_layout_nb_channels(insamples->audio->channel_layout); int i, j, h; const int n = showwaves->n; const int x = 255 / (nb_channels * n); /* multiplication factor, pre-computed to avoid in-loop divisions */ /* draw data in the buffer */ for (i = 0; i < nb_samples; i++) { if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) { showwaves->outpicref = outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN, outlink->w, outlink->h); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; outpicref->pts = insamples->pts + av_rescale_q((p - (int16_t *)insamples->data[0]) / nb_channels, (AVRational){ 1, inlink->sample_rate }, outlink->time_base); outlink->out_buf = outpicref; linesize = outpicref->linesize[0]; memset(outpicref->data[0], 0, showwaves->h*linesize); } for (j = 0; j < nb_channels; j++) { h = showwaves->h/2 - av_rescale(*p++, showwaves->h/2, MAX_INT16); if (h >= 0 && h < outlink->h) *(outpicref->data[0] + showwaves->buf_idx + h * linesize) += x; } showwaves->sample_count_mod++; if (showwaves->sample_count_mod == n) { showwaves->sample_count_mod = 0; showwaves->buf_idx++; } if (showwaves->buf_idx == showwaves->w) push_frame(outlink); } avfilter_unref_buffer(insamples); return 0; }


int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2().\n"); return AVERROR(EINVAL); if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2().\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); /* If there is a user-supplied mutex locking routine, call it. */ if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) { if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; entangled_thread_counter++; if (entangled_thread_counter != 1) { av_log(avctx, AV_LOG_ERROR, "Insufficient thread locking. At least %d threads are " "calling avcodec_open2() at the same time right now.\n", entangled_thread_counter); ret = -1; goto end; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); if (!avctx->internal->pool) { ret = AVERROR(ENOMEM); avctx->internal->to_free = av_frame_alloc(); if (!avctx->internal->to_free) { ret = AVERROR(ENOMEM); avctx->internal->buffer_frame = av_frame_alloc(); if (!avctx->internal->buffer_frame) { ret = AVERROR(ENOMEM); avctx->internal->buffer_pkt = av_packet_alloc(); if (!avctx->internal->buffer_pkt) { ret = AVERROR(ENOMEM); if (codec->priv_data_size > 0) { if (!avctx->priv_data) { avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) } else { avctx->priv_data = NULL; if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) if (avctx->coded_width && avctx->coded_height && !avctx->width && !avctx->height) ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if (avctx->width && avctx->height) ret = ff_set_dimensions(avctx, avctx->width, avctx->height); if (ret < 0) if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); ff_set_dimensions(avctx, 0, 0); if (avctx->width > 0 && avctx->height > 0) { if (av_image_check_sar(avctx->width, avctx->height, avctx->sample_aspect_ratio) < 0) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; /* if the decoder init function was already called previously, * free the already allocated subtitle_header before overwriting it */ if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); if (avctx->channels > FF_SANE_NB_CHANNELS) { avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); avctx->frame_number = 0; if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { ret = AVERROR_EXPERIMENTAL; if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; if (HAVE_THREADS) { ret = ff_thread_init(avctx); if (ret < 0) { if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (av_codec_is_encoder(avctx->codec)) { int i; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { ret = AVERROR(ENOMEM); FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->channels == 1 && av_get_planar_sample_fmt(avctx->sample_fmt) == av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { avctx->sample_fmt = avctx->codec->sample_fmts[i]; break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified pix_fmt is not supported\n"); if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P || avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P || avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P || avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P) avctx->color_range = AVCOL_RANGE_JPEG; if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample_rate is not supported\n"); if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "channel_layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified channel_layout is not supported\n"); if (avctx->channel_layout && avctx->channels) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n"); } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->rc_initial_buffer_occupancy) avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; if (avctx->ticks_per_frame && avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) { av_log(avctx, AV_LOG_ERROR, "ticks_per_frame %d too large for the timebase %d/%d.", avctx->ticks_per_frame, avctx->time_base.num, avctx->time_base.den); if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; if (frames_ctx->format != avctx->pix_fmt) { av_log(avctx, AV_LOG_ERROR, "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n"); if (avctx->codec->init && !(avctx->active_thread_type & FF_THREAD_FRAME)) { ret = avctx->codec->init(avctx); if (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)) { /* validate channel layout from the decoder */ if (avctx->channel_layout) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->channels) avctx->channels = channels; else if (channels != avctx->channels) { av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n"); avctx->channel_layout = 0; if (avctx->channels && avctx->channels < 0 || avctx->channels > FF_SANE_NB_CHANNELS) { #if FF_API_AVCTX_TIMEBASE if (avctx->framerate.num > 0 && avctx->framerate.den > 0) avctx->time_base = av_inv_q(avctx->framerate); #endif end: if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) { entangled_thread_counter--; /* Release any user-supplied mutex. */ if (lockmgr_cb) { (*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); if (options) { av_dict_free(options); *options = tmp; return ret; free_and_end: if (avctx->codec && (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)) avctx->codec->close(avctx); if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data); av_opt_free(avctx); #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS av_frame_free(&avctx->coded_frame); FF_ENABLE_DEPRECATION_WARNINGS #endif av_dict_free(&tmp); av_freep(&avctx->priv_data); if (avctx->internal) { av_frame_free(&avctx->internal->to_free); av_freep(&avctx->internal->pool); av_freep(&avctx->internal); avctx->codec = NULL; goto end;


DECLARE_LOOP_FILTER(mmxext) DECLARE_LOOP_FILTER(sse2) DECLARE_LOOP_FILTER(ssse3) DECLARE_LOOP_FILTER(sse4) #endif /* HAVE_YASM */ #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \ c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT #define VP8_MC_FUNC(IDX, SIZE, OPT) \ c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \ VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) #define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \ c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) { #if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx; c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx; #if ARCH_X86_32 c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx; c->vp8_idct_add = ff_vp8_idct_add_mmx; c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx; c->put_vp8_epel_pixels_tab[0][0][0] = c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx; #endif c->put_vp8_epel_pixels_tab[1][0][0] = c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx; #if ARCH_X86_32 c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx; c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx; c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx; c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx; c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx; c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmx; c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmx; c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmx; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmx; #endif } /* note that 4-tap width=16 functions are missing because w=16 * is only used for luma, and luma is always a copy or sixtap. */ if (mm_flags & AV_CPU_FLAG_MMXEXT) { VP8_MC_FUNC(2, 4, mmxext); VP8_BILINEAR_MC_FUNC(2, 4, mmxext); #if ARCH_X86_32 VP8_LUMA_MC_FUNC(0, 16, mmxext); VP8_MC_FUNC(1, 8, mmxext); VP8_BILINEAR_MC_FUNC(0, 16, mmxext); VP8_BILINEAR_MC_FUNC(1, 8, mmxext); c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmxext; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmxext; c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext; c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext; c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext; c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext; c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmxext; c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmxext; c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmxext; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext; #endif } if (mm_flags & AV_CPU_FLAG_SSE) { c->vp8_idct_add = ff_vp8_idct_add_sse; c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse; c->put_vp8_epel_pixels_tab[0][0][0] = c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse; } if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) { VP8_LUMA_MC_FUNC(0, 16, sse2); VP8_MC_FUNC(1, 8, sse2); VP8_BILINEAR_MC_FUNC(0, 16, sse2); VP8_BILINEAR_MC_FUNC(1, 8, sse2); c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2; #if ARCH_X86_64 || HAVE_ALIGNED_STACK c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2; c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2; c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_sse2; c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2; #endif } if (mm_flags & AV_CPU_FLAG_SSE2) { c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2; #if ARCH_X86_64 || HAVE_ALIGNED_STACK c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2; c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2; c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse2; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2; #endif } if (mm_flags & AV_CPU_FLAG_SSSE3) { VP8_LUMA_MC_FUNC(0, 16, ssse3); VP8_MC_FUNC(1, 8, ssse3); VP8_MC_FUNC(2, 4, ssse3); VP8_BILINEAR_MC_FUNC(0, 16, ssse3); VP8_BILINEAR_MC_FUNC(1, 8, ssse3); VP8_BILINEAR_MC_FUNC(2, 4, ssse3); c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3; #if ARCH_X86_64 || HAVE_ALIGNED_STACK c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3; c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3; c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3; c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3; c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_ssse3; c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_ssse3; c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_ssse3; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3; #endif } if (mm_flags & AV_CPU_FLAG_SSE4) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4; #if ARCH_X86_64 || HAVE_ALIGNED_STACK c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4; #endif } #endif /* HAVE_YASM */ }


static av_always_inline int get_dst_color_err(PaletteUseContext *s, uint32_t c, int *er, int *eg, int *eb, const enum color_search_method search_method) { const uint8_t a = c >> 24 & 0xff; const uint8_t r = c >> 16 & 0xff; const uint8_t g = c >> 8 & 0xff; const uint8_t b = c & 0xff; const int dstx = color_get(s, c, a, r, g, b, search_method); const uint32_t dstc = s->palette[dstx]; *er = r - (dstc >> 16 & 0xff); *eg = g - (dstc >> 8 & 0xff); *eb = b - (dstc & 0xff); return dstx; }


static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){ int i; if(v){ const int a= FFABS(v); const int e= av_log2(a); put_rac(c, state+0, 0); assert(e<=9); for(i=0; i<e; i++){ put_rac(c, state+1+i, 1); //1..10 } put_rac(c, state+1+i, 0); for(i=e-1; i>=0; i--){ put_rac(c, state+22+i, (a>>i)&1); //22..31 } if(is_signed) put_rac(c, state+11 + e, v < 0); //11..21 }else{ put_rac(c, state+0, 1); } }


static void rgb24_to_rgb555(AVPicture *dst, AVPicture *src, int width, int height) { const unsigned char *p; unsigned char *q; int r, g, b, dst_wrap, src_wrap; int x, y; p = src->data[0]; src_wrap = src->linesize[0] - 3 * width; q = dst->data[0]; dst_wrap = dst->linesize[0] - 2 * width; for(y=0;y<height;y++) { for(x=0;x<width;x++) { r = p[0]; g = p[1]; b = p[2]; ((unsigned short *)q)[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | 0x8000; q += 2; p += 3; } p += src_wrap; q += dst_wrap; } }


static void avc_wgt_8width_msa(uint8_t *data, int32_t stride, int32_t height, int32_t log2_denom, int32_t src_weight, int32_t offset_in) { uint8_t cnt; v16u8 zero = { 0 }; v16u8 src0, src1, src2, src3; v8u16 src0_r, src1_r, src2_r, src3_r; v8u16 temp0, temp1, temp2, temp3; v8u16 wgt, denom, offset; offset_in <<= (log2_denom); if (log2_denom) { offset_in += (1 << (log2_denom - 1)); } wgt = (v8u16) __msa_fill_h(src_weight); offset = (v8u16) __msa_fill_h(offset_in); denom = (v8u16) __msa_fill_h(log2_denom); for (cnt = height / 4; cnt--;) { LOAD_4VECS_UB(data, stride, src0, src1, src2, src3); ILVR_B_4VECS_UH(src0, src1, src2, src3, zero, zero, zero, zero, src0_r, src1_r, src2_r, src3_r); temp0 = wgt * src0_r; temp1 = wgt * src1_r; temp2 = wgt * src2_r; temp3 = wgt * src3_r; ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset, temp2, offset, temp3, offset, temp0, temp1, temp2, temp3); MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0); SRL_H_4VECS_UH(temp0, temp1, temp2, temp3, temp0, temp1, temp2, temp3, denom); SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7); PCKEV_B_STORE_8_BYTES_4(temp0, temp1, temp2, temp3, data, stride); data += (4 * stride); } }


static void opt_frame_pad_left(const char *arg) { frame_padleft = atoi(arg); if (frame_padleft < 0) { fprintf(stderr, "Incorrect left pad size\n"); av_exit(1); } }


ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) { int name_size = 8; /* "CORE" or "QEMU" rounded */ size_t elf_note_size = 0; int note_head_size; const NoteFuncDesc *nf; assert(class == ELFCLASS64); assert(machine == EM_S390); note_head_size = sizeof(Elf64_Nhdr); for (nf = note_func; nf->note_contents_func; nf++) { elf_note_size = elf_note_size + note_head_size + name_size + nf->contents_size; } return (elf_note_size) * nr_cpus; }


static void add_query_tests(QmpSchema *schema) { SchemaInfoList *tail; SchemaInfo *si, *arg_type, *ret_type; const char *test_name; /* Test the query-like commands */ for (tail = schema->list; tail; tail = tail->next) { si = tail->value; if (si->meta_type != SCHEMA_META_TYPE_COMMAND) { continue; } if (query_is_blacklisted(si->name)) { continue; } arg_type = qmp_schema_lookup(schema, si->u.command.arg_type); if (object_type_has_mandatory_members(arg_type)) { continue; } ret_type = qmp_schema_lookup(schema, si->u.command.ret_type); if (ret_type->meta_type == SCHEMA_META_TYPE_OBJECT && !ret_type->u.object.members) { continue; } test_name = g_strdup_printf("qmp/%s", si->name); qtest_add_data_func(test_name, si->name, test_query); } }


static void cpu_handle_guest_debug(CPUState *env) { gdb_set_stop_cpu(env); qemu_system_debug_request(); #ifdef CONFIG_IOTHREAD env->stopped = 1; #endif }


vmxnet3_io_bar1_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { VMXNET3State *s = opaque; switch (addr) { /* Vmxnet3 Revision Report Selection */ case VMXNET3_REG_VRRS: VMW_CBPRN("Write BAR1 [VMXNET3_REG_VRRS] = %" PRIx64 ", size %d", val, size); break; /* UPT Version Report Selection */ case VMXNET3_REG_UVRS: VMW_CBPRN("Write BAR1 [VMXNET3_REG_UVRS] = %" PRIx64 ", size %d", val, size); break; /* Driver Shared Address Low */ case VMXNET3_REG_DSAL: VMW_CBPRN("Write BAR1 [VMXNET3_REG_DSAL] = %" PRIx64 ", size %d", val, size); /* * Guest driver will first write the low part of the shared * memory address. We save it to temp variable and set the * shared address only after we get the high part */ if (val == 0) { s->device_active = false; } s->temp_shared_guest_driver_memory = val; s->drv_shmem = 0; break; /* Driver Shared Address High */ case VMXNET3_REG_DSAH: VMW_CBPRN("Write BAR1 [VMXNET3_REG_DSAH] = %" PRIx64 ", size %d", val, size); /* * Set the shared memory between guest driver and device. * We already should have low address part. */ s->drv_shmem = s->temp_shared_guest_driver_memory | (val << 32); break; /* Command */ case VMXNET3_REG_CMD: VMW_CBPRN("Write BAR1 [VMXNET3_REG_CMD] = %" PRIx64 ", size %d", val, size); vmxnet3_handle_command(s, val); break; /* MAC Address Low */ case VMXNET3_REG_MACL: VMW_CBPRN("Write BAR1 [VMXNET3_REG_MACL] = %" PRIx64 ", size %d", val, size); s->temp_mac = val; break; /* MAC Address High */ case VMXNET3_REG_MACH: VMW_CBPRN("Write BAR1 [VMXNET3_REG_MACH] = %" PRIx64 ", size %d", val, size); vmxnet3_set_variable_mac(s, val, s->temp_mac); break; /* Interrupt Cause Register */ case VMXNET3_REG_ICR: VMW_CBPRN("Write BAR1 [VMXNET3_REG_ICR] = %" PRIx64 ", size %d", val, size); g_assert_not_reached(); break; /* Event Cause Register */ case VMXNET3_REG_ECR: VMW_CBPRN("Write BAR1 [VMXNET3_REG_ECR] = %" PRIx64 ", size %d", val, size); vmxnet3_ack_events(s, val); break; default: VMW_CBPRN("Unknown Write to BAR1 [%" PRIx64 "] = %" PRIx64 ", size %d", addr, val, size); break; } }


static int64_t alloc_block(BlockDriverState* bs, int64_t offset) { BDRVVPCState *s = bs->opaque; int64_t bat_offset; uint32_t index, bat_value; int ret; uint8_t bitmap[s->bitmap_size]; /* Check if sector_num is valid */ if ((offset < 0) || (offset > bs->total_sectors * BDRV_SECTOR_SIZE)) { return -EINVAL; } /* Write entry into in-memory BAT */ index = offset / s->block_size; assert(s->pagetable[index] == 0xFFFFFFFF); s->pagetable[index] = s->free_data_block_offset / 512; /* Initialize the block's bitmap */ memset(bitmap, 0xff, s->bitmap_size); ret = bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size); if (ret < 0) { return ret; } /* Write new footer (the old one will be overwritten) */ s->free_data_block_offset += s->block_size + s->bitmap_size; ret = rewrite_footer(bs); if (ret < 0) goto fail; /* Write BAT entry to disk */ bat_offset = s->bat_offset + (4 * index); bat_value = cpu_to_be32(s->pagetable[index]); ret = bdrv_pwrite_sync(bs->file, bat_offset, &bat_value, 4); if (ret < 0) goto fail; return get_image_offset(bs, offset, false); fail: s->free_data_block_offset -= (s->block_size + s->bitmap_size); return ret; }


static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned int src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_16mask),"m"(green_16mask)); mm_end = end - 15; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psllq $8, %%mm0\n\t" "psllq $8, %%mm3\n\t" "pand %%mm7, %%mm0\n\t" "pand %%mm7, %%mm3\n\t" "psrlq $5, %%mm1\n\t" "psrlq $5, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $19, %%mm2\n\t" "psrlq $19, %%mm5\n\t" "pand %2, %%mm2\n\t" "pand %2, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory"); d += 4; s += 16; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { // FIXME on bigendian const int src= *s; s += 4; *d++ = ((src&0xF8)<<8) + ((src&0xFC00)>>5) + ((src&0xF80000)>>19); } }