Re: [FFmpeg-devel] [PATCH] lavd/sdl2: postpone sdl2 window creation
> On Sep 19, 2023, at 14:32, Xiang, Haihao > wrote: > > On Ma, 2023-09-18 at 14:00 +0200, Andreas Rheinhardt wrote: >> Xiang, Haihao: >>> From: Haihao Xiang >>> >>> Since 2d924b3, sdl2_write_header() and sdl2_write_packet() are called >>> in two different threads. However SDL2 requires window creation and >>> rendering should be done in the same thread, otherwise it shows nothing >>> when specifying SDL2 output device. >> >> Modifying a library to fix behaviour in an application (even the FFmpeg >> tool) is very fishy. > > Seems calling sdl2_write_header() and sdl2_write_packet() in two different > threads are allowed. I think the change in commit 2d924b3 revealed a bug in > libavdevice, we should fix libavdevice. SDL *must* be run in main thread on some platform like macOS. I don’t think it’s practical to fix the issue inside libavdevice. Add some checks like wether write_header and write packet run in the same thread can be helpful, but it doesn’t solve current issue. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse warning: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x0001872c88c0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000186dc1eb4 objc_exception_throw + 60 2 Foundation 0x00018840f18c -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00018aa0a444 -[NSMenu _setMenuName:] + 488 4 AppKit 0x00018aa1efe8 -[NSApplication setMainMenu:] + 372 5 libSDL2-2.0.0.dylib 0x0001044c9704 Cocoa_RegisterApp + 420 6 libSDL2-2.0.0.dylib 0x0001044cf124 Cocoa_CreateDevice + 28 7 libSDL2-2.0.0.dylib 0x0001044b7084 SDL_VideoInit_REAL + 464 8 libSDL2-2.0.0.dylib 0x00010442787c SDL_InitSubSystem_REAL + 204 > > >> This patch makes things worse for people who want >> their call to avformat_write_header() to actually check whether sdl2 works. > > sdl2_write_header() always returns 0 (you also pointed it out below), so this > change doesn't have impact to user if user want to use avformat_write_header() > to check whether sdl2 works. > >> >>> >>> $ ffmpeg -f lavfi -i yuvtestsrc -pix_fmt yuv420p -f sdl2 "sdl2" >>> >>> Signed-off-by: Haihao Xiang >>> --- >>> libavdevice/sdl2.c | 13 + >>> 1 file changed, 13 insertions(+) >>> >>> diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c >>> index 342a253dc0..c9f7f03c28 100644 >>> --- a/libavdevice/sdl2.c >>> +++ b/libavdevice/sdl2.c >>> @@ -158,6 +158,11 @@ static int sdl2_write_trailer(AVFormatContext *s) >>> } >>> >>> static int sdl2_write_header(AVFormatContext *s) >>> +{ >>> +return 0; >>> +} >> >> There is no reason to keep an empty write-header function around. Just >> delete the function pointer in the FFOutputFormat. > > Thanks for pointing it out, I will delete it in the next version if you agree > we > should fix the library. > >> >>> + >>> +static int sdl2_init(AVFormatContext *s) >>> { >>> SDLContext *sdl = s->priv_data; >>> AVStream *st = s->streams[0]; >>> @@ -165,6 +170,9 @@ static int sdl2_write_header(AVFormatContext *s) >>> int i, ret = 0; >>> int flags = 0; >>> >>> +if (sdl->inited) >> >> I am not an sdl2-expert at all (in fact, your patch made me read their >> headers for the first time), but it seems to me that you misread the >> semantics of "inited": It is set if someone else already initialized the >> library or if we called sdl2_write_header() without entering the fail >> path. In particular, inited being set does not mean that we called >> sdl2_write_header() without entering the fail path. >> >> The reason I am writing "without entering the fail path" and not >> "returns an error" is that sdl2_write_header() actually never sets an >> error on any error path. This means that the sdl2_init() below will >> always succeed. > > Honestly I am not an sdl2 expert too. I noticed sdl2_write_header() always > return 0, and sdl2_write_packet() is called even if sdl2_write_header() enters > the fail path. What I wanted is to make sdl2 works again and do not change the > code too much, hence I made sdl2_init() works as sdl2_write_header() with a > small change. I should look into the usage of inited carefully. > >> >> Given that inited is currently only used for one thing (namely checking >> whether SDL_Quit() should be called), it would be equivalent to the >> current code to move the call to SDL_Quit() to the error path in >> sdl2_write_header() and to make inited a local variable in >> sdl2_write_header(). >> >> The reason for the way inited is handled seems to me that because >> SDL_Quit() quits eve
Re: [FFmpeg-devel] [PATCH] avformat/mxfenc: fix static building
On 9/19/23 17:12, Michael Riedl wrote: > MXF muxer requires rangecoder otherwise static linking fails. > > Signed-off-by: Michael Riedl > --- > configure | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure b/configure > index 3bb68d3f20c..9d4297ea68f 100755 > --- a/configure > +++ b/configure > @@ -3532,7 +3532,7 @@ mp4_muxer_select="mov_muxer" > mpegts_demuxer_select="iso_media" > mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf > hevc_mp4toannexb_bsf" > mpegtsraw_demuxer_select="mpegts_demuxer" > -mxf_muxer_select="pcm_rechunk_bsf" > +mxf_muxer_select="pcm_rechunk_bsf rangecoder" > mxf_d10_muxer_select="mxf_muxer" > mxf_opatom_muxer_select="mxf_muxer" > nut_muxer_select="riffenc" Ping. Without this patch master fails to build when ffv1 is not enabled. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH avcodec/amfenc: 10 bit support, v4, 1/3] avcodec/amfenc: Fixes the color information in the output.
From: Michael Fabian 'Xaymar' Dirks added 10 bit support for amf hevc. before: command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file.mkv -an -c:v h264_amf res.dx11_hw_h264.mkv output - Format of input frames context (p010le) is not supported by AMF. command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v hevc_amf res.dx11_hw_hevc.mkv output - Format of input frames context (p010le) is not supported by AMF. after: command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v h264_amf res.dx11_hw_h264.mkv output - 10-bit input video is not supported by AMF H264 encoder command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v hevc_amf res.dx11_hw_hevc.mkv output - 10bit file v2 - lost line returned in ff_amf_pix_fmts v3 - fixes after review v4 - extract duplicated code, fix incorrect processing of 10-bit input for h264 Co-authored-by: Evgeny Pavlov --- libavcodec/amfenc.c | 37 + libavcodec/amfenc.h | 3 +++ libavcodec/amfenc_h264.c | 24 libavcodec/amfenc_hevc.c | 26 +- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 061859f85c..0bd15dd812 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -60,6 +60,7 @@ const enum AVPixelFormat ff_amf_pix_fmts[] = { #if CONFIG_DXVA2 AV_PIX_FMT_DXVA2_VLD, #endif +AV_PIX_FMT_P010, AV_PIX_FMT_NONE }; @@ -72,6 +73,7 @@ static const FormatMap format_map[] = { { AV_PIX_FMT_NONE, AMF_SURFACE_UNKNOWN }, { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, +{ AV_PIX_FMT_P010, AMF_SURFACE_P010 }, { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, @@ -785,6 +787,41 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) return ret; } +int ff_amf_get_color_profile(AVCodecContext *avctx) +{ +amf_int64 color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN; +if (avctx->color_range == AVCOL_RANGE_JPEG) { +/// Color Space for Full (JPEG) Range +switch (avctx->colorspace) { +case AVCOL_SPC_SMPTE170M: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601; +break; +case AVCOL_SPC_BT709: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709; +break; +case AVCOL_SPC_BT2020_NCL: +case AVCOL_SPC_BT2020_CL: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020; +break; +} +} else { +/// Color Space for Limited (MPEG) range +switch (avctx->colorspace) { +case AVCOL_SPC_SMPTE170M: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601; +break; +case AVCOL_SPC_BT709: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709; +break; +case AVCOL_SPC_BT2020_NCL: +case AVCOL_SPC_BT2020_CL: +color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020; +break; +} +} +return color_profile; +} + const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[] = { #if CONFIG_D3D11VA HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11VA), diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 2dbd378ef8..62736ef579 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -170,6 +171,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); */ extern const enum AVPixelFormat ff_amf_pix_fmts[]; +int ff_amf_get_color_profile(AVCodecContext *avctx); + /** * Error handling helper */ diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c index bd544d12df..f785e091c9 100644 --- a/libavcodec/amfenc_h264.c +++ b/libavcodec/amfenc_h264.c @@ -199,6 +199,8 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx) AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0; +amf_int64color_profile; +enum AVPixelFormat pix_fmt; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den); @@ -262,10 +264,24 @@ FF_ENABLE_DEPRECATION_WARNINGS AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio); } -/// Color Range (Partial/TV/MPEG or Full/PC/JPEG) -if (avctx->color_range == AVCOL_RANGE_
[FFmpeg-devel] [PATCH 10 bit support, v4, 2/3] avcodec/amfenc: HDR metadata.
From: nyanmisaka v2: fixes for indentation --- libavcodec/amfenc.c | 83 + 1 file changed, 83 insertions(+) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 0bd15dd812..068bb53002 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -36,6 +36,57 @@ #include "amfenc.h" #include "encode.h" #include "internal.h" +#include "libavutil/mastering_display_metadata.h" + +static int amf_save_hdr_metadata(AVCodecContext *avctx, const AVFrame *frame, AMFHDRMetadata *hdrmeta) +{ +AVFrameSideData*sd_display; +AVFrameSideData*sd_light; +AVMasteringDisplayMetadata *display_meta; +AVContentLightMetadata *light_meta; + +sd_display = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); +if (sd_display) { +display_meta = (AVMasteringDisplayMetadata *)sd_display->data; +if (display_meta->has_luminance) { +const unsigned int luma_den = 1; +hdrmeta->maxMasteringLuminance = +(amf_uint32)(luma_den * av_q2d(display_meta->max_luminance)); +hdrmeta->minMasteringLuminance = +FFMIN((amf_uint32)(luma_den * av_q2d(display_meta->min_luminance)), hdrmeta->maxMasteringLuminance); +} +if (display_meta->has_primaries) { +const unsigned int chroma_den = 5; +hdrmeta->redPrimary[0] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[0][0])), chroma_den); +hdrmeta->redPrimary[1] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[0][1])), chroma_den); +hdrmeta->greenPrimary[0] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[1][0])), chroma_den); +hdrmeta->greenPrimary[1] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[1][1])), chroma_den); +hdrmeta->bluePrimary[0] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[2][0])), chroma_den); +hdrmeta->bluePrimary[1] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[2][1])), chroma_den); +hdrmeta->whitePoint[0] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->white_point[0])), chroma_den); +hdrmeta->whitePoint[1] = +FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->white_point[1])), chroma_den); +} + +sd_light = av_frame_get_side_data(frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); +if (sd_light) { +light_meta = (AVContentLightMetadata *)sd_light->data; +if (light_meta) { +hdrmeta->maxContentLightLevel = (amf_uint16)light_meta->MaxCLL; +hdrmeta->maxFrameAverageLightLevel = (amf_uint16)light_meta->MaxFALL; +} +} +return 0; +} +return 1; +} #if CONFIG_D3D11VA #include @@ -683,6 +734,26 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer); } +// HDR10 metadata +if (frame->color_trc == AVCOL_TRC_SMPTE2084) { +AMFBuffer * hdrmeta_buffer = NULL; +res = ctx->context->pVtbl->AllocBuffer(ctx->context, AMF_MEMORY_HOST, sizeof(AMFHDRMetadata), &hdrmeta_buffer); +if (res == AMF_OK) { +AMFHDRMetadata * hdrmeta = (AMFHDRMetadata*)hdrmeta_buffer->pVtbl->GetNative(hdrmeta_buffer); +if (amf_save_hdr_metadata(avctx, frame, hdrmeta) == 0) { +switch (avctx->codec->id) { +case AV_CODEC_ID_H264: +AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_HDR_METADATA, hdrmeta_buffer); break; +case AV_CODEC_ID_HEVC: +AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA, hdrmeta_buffer); break; +} +res = amf_set_property_buffer(surface, L"av_frame_hdrmeta", hdrmeta_buffer); +AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN, "SetProperty failed for \"av_frame_hdrmeta\" with error %d\n", res); +} +hdrmeta_buffer->pVtbl->Release(hdrmeta_buffer); +} +} + surface->pVtbl->SetPts(surface, frame->pts); AMF_ASSIGN_PROPERTY_INT64(res, surface, PTS_PROP, frame->pts); @@ -746,6 +817,18 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) } res_resubmit = AMF_OK; if (ctx->delayed_surface != NULL) { // try to resubmit frame +if (ctx->delayed_surface->pVtbl->HasProperty(ctx->delayed_surface, L"av_frame_hdrmeta")) { +AMFBuffer
[FFmpeg-devel] [PATCH 10 bit support, v4, 3/3] avcodec/amfenc: add 10 bit encoding in av1_amf
v2: refactored after review Signed-off-by: Evgeny Pavlov Co-authored-by: Dmitrii Ovchinnikov --- libavcodec/amfenc.c | 2 ++ libavcodec/amfenc_av1.c | 22 ++ 2 files changed, 24 insertions(+) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 068bb53002..f1b76bd6aa 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -826,6 +826,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_HDR_METADATA, hdrmeta_buffer); break; case AV_CODEC_ID_HEVC: AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA, hdrmeta_buffer); break; +case AV_CODEC_ID_AV1: +AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_INPUT_HDR_METADATA, hdrmeta_buffer); break; } hdrmeta_buffer->pVtbl->Release(hdrmeta_buffer); } diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c index 8f13aea29e..634eeea48f 100644 --- a/libavcodec/amfenc_av1.c +++ b/libavcodec/amfenc_av1.c @@ -165,6 +165,9 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx) AMFGuid guid; AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); +amf_int64 color_depth; +amf_int64 color_profile; +enumAVPixelFormat pix_fmt; @@ -203,6 +206,25 @@ FF_ENABLE_DEPRECATION_WARNINGS } AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_PROFILE, profile); +/// Color profile +color_profile = ff_amf_get_color_profile(avctx); +AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE, color_profile); + +/// Color Depth +pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format +: avctx->pix_fmt; +color_depth = AMF_COLOR_BIT_DEPTH_8; +if (pix_fmt == AV_PIX_FMT_P010) { +color_depth = AMF_COLOR_BIT_DEPTH_10; +} + +AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_COLOR_BIT_DEPTH, color_depth); +AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE, color_profile); +/// Color Transfer Characteristics (AMF matches ISO/IEC) +AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc); +/// Color Primaries (AMF matches ISO/IEC) +AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries); + profile_level = avctx->level; if (profile_level == AV_LEVEL_UNKNOWN) { profile_level = ctx->level; -- 2.41.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 06/13] avcodec/mpegvideo_enc: Don't overallocate arrays
Andreas Rheinhardt: > Michael Niedermayer: >> On Fri, Oct 06, 2023 at 04:46:29AM +0200, Andreas Rheinhardt wrote: >>> Only entries 0..max_b_frames are ever used. >>> >>> Signed-off-by: Andreas Rheinhardt >>> --- >>> libavcodec/mpegvideo_enc.c | 10 +- >>> 1 file changed, 5 insertions(+), 5 deletions(-) >>> >>> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c >>> index 1e0aed8db9..c06fdd08fe 100644 >>> --- a/libavcodec/mpegvideo_enc.c >>> +++ b/libavcodec/mpegvideo_enc.c >>> @@ -819,8 +819,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_intra_matrix16,32) || >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_chroma_intra_matrix16, 32) || >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_inter_matrix16,32) || >>> -!FF_ALLOCZ_TYPED_ARRAY(s->input_picture, >>> MAX_PICTURE_COUNT) || >>> -!FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, >>> MAX_PICTURE_COUNT)) >>> +!FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_B_FRAMES + >>> 1) || >>> +!FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_B_FRAMES + >>> 1)) >>> return AVERROR(ENOMEM); >>> >>> /* Allocate MV tables; the MV and MB tables will be copied >>> @@ -1231,7 +1231,7 @@ static int load_input_picture(MpegEncContext *s, >>> const AVFrame *pic_arg) >>> } >>> >>> /* shift buffer entries */ >>> -for (i = flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay + >>> 1*/; i++) >>> +for (int i = flush_offset; i <= MAX_B_FRAMES; i++) >>> s->input_picture[i - flush_offset] = s->input_picture[i]; >>> >>> s->input_picture[encoding_delay] = pic; >>> @@ -1450,9 +1450,9 @@ static int select_input_picture(MpegEncContext *s) >>> { >>> int i, ret; >>> >>> -for (i = 1; i < MAX_PICTURE_COUNT; i++) >>> +for (int i = 1; i <= MAX_B_FRAMES; i++) >>> s->reordered_input_picture[i - 1] = s->reordered_input_picture[i]; >> >> I see the addition of "int" and that seems neither needed nor >> explained why in the commit message >> > > It's part of the general switch to the loop-based iterators wherever > possible (it is better because it automatically indicates that the value > at the end of the loop doesn't matter and it also allows to more easily > move blocks of code around). I always use them when I touch a loop. > > If it matters: That i in the outer scope survives this patchset, but it > won't survive for long. > Are you ok with this patch and the rest of the patchset? I'd like to apply it tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/libvmaf: remove deprecated options
Hi, On Thu, Oct 5, 2023 at 1:19 PM Kyle Swanson wrote: > Removal of deprecated libvmaf filter options. These options have been > deprecated since 3d29724c008d8f27fecf85757152789b074e8ef9 (Jan 23, > 2022). Patch attached. I'll push this tomorrow. Thanks, Kyle ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 06/13] avcodec/mpegvideo_enc: Don't overallocate arrays
On Mon, Oct 09, 2023 at 02:30:21PM +0200, Andreas Rheinhardt wrote: > Andreas Rheinhardt: > > Michael Niedermayer: > >> On Fri, Oct 06, 2023 at 04:46:29AM +0200, Andreas Rheinhardt wrote: > >>> Only entries 0..max_b_frames are ever used. > >>> > >>> Signed-off-by: Andreas Rheinhardt > >>> --- > >>> libavcodec/mpegvideo_enc.c | 10 +- > >>> 1 file changed, 5 insertions(+), 5 deletions(-) > >>> > >>> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c > >>> index 1e0aed8db9..c06fdd08fe 100644 > >>> --- a/libavcodec/mpegvideo_enc.c > >>> +++ b/libavcodec/mpegvideo_enc.c > >>> @@ -819,8 +819,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) > >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_intra_matrix16,32) || > >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_chroma_intra_matrix16, 32) || > >>> !FF_ALLOCZ_TYPED_ARRAY(s->q_inter_matrix16,32) || > >>> -!FF_ALLOCZ_TYPED_ARRAY(s->input_picture, > >>> MAX_PICTURE_COUNT) || > >>> -!FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, > >>> MAX_PICTURE_COUNT)) > >>> +!FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_B_FRAMES > >>> + 1) || > >>> +!FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_B_FRAMES > >>> + 1)) > >>> return AVERROR(ENOMEM); > >>> > >>> /* Allocate MV tables; the MV and MB tables will be copied > >>> @@ -1231,7 +1231,7 @@ static int load_input_picture(MpegEncContext *s, > >>> const AVFrame *pic_arg) > >>> } > >>> > >>> /* shift buffer entries */ > >>> -for (i = flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay + > >>> 1*/; i++) > >>> +for (int i = flush_offset; i <= MAX_B_FRAMES; i++) > >>> s->input_picture[i - flush_offset] = s->input_picture[i]; > >>> > >>> s->input_picture[encoding_delay] = pic; > >>> @@ -1450,9 +1450,9 @@ static int select_input_picture(MpegEncContext *s) > >>> { > >>> int i, ret; > >>> > >>> -for (i = 1; i < MAX_PICTURE_COUNT; i++) > >>> +for (int i = 1; i <= MAX_B_FRAMES; i++) > >>> s->reordered_input_picture[i - 1] = > >>> s->reordered_input_picture[i]; > >> > >> I see the addition of "int" and that seems neither needed nor > >> explained why in the commit message > >> > > > > It's part of the general switch to the loop-based iterators wherever > > possible (it is better because it automatically indicates that the value > > at the end of the loop doesn't matter and it also allows to more easily > > move blocks of code around). I always use them when I touch a loop. > > > > If it matters: That i in the outer scope survives this patchset, but it > > won't survive for long. > > > > Are you ok with this patch ok > and the rest of the patchset? I'd like to > apply it tomorrow unless there are objections. i have no objections thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [RFC] Release 6.1
On Mon, Oct 09, 2023 at 05:37:42AM +0200, Lynne wrote: > Jul 6, 2023, 18:04 by d...@lynne.ee: > > > It's been a while since we've had a release, and we've had > > a lot of new features in. > > We did say we would make releases more often, and I think > > it's about time we have a new release. > > > > Anything anyone wants to have merged or should we branch > > off 6.1 in a few days? > > > > Could we consider at least branching off 6.1? we can consider branching whenever theres a consensus to do so People are always quick in saying what they want in / done before releases/branching. But its rare that people later reply and say that an issue was resolved. This makes monitoring for what blockers remain painfull i think for the next release we should automate this because trac has a "Blocking" field and that could be set to 6.1 for example and then one can just query trac for all open tickets that are blocking "6.1" Which would make it MUCH easier to know what is blocking it and would make it easier to know when all blockers are gone ATM one has to go over multiple threads and then figure out what people asked for to be done first and then find out if the things are still not done. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] avformat/mov: Add support for demuxing still HEIC images
On Thu, Oct 5, 2023 at 3:40 PM Vignesh Venkat wrote: > > > > On Thu, Oct 5, 2023 at 10:36 AM Vittorio Giovara > wrote: >> >> >> >> On Wed, Oct 4, 2023 at 12:40 PM Vignesh Venkatasubramanian via ffmpeg-devel >> wrote: >>> >>> They are similar to AVIF images (both use the HEIF container). >>> The only additional work needed is to parse the hvcC box and put >>> it in the extradata. >>> >>> With this patch applied, ffmpeg (when built with an HEVC decoder) >>> is able to decode the files in >>> https://github.com/nokiatech/heif/tree/gh-pages/content/images >>> >>> Also add a couple of fate tests with samples from >>> https://github.com/nokiatech/heif_conformance/tree/master/conformance_files >>> >>> Partially fixes trac ticket #6521. >>> >>> Signed-off-by: Vignesh Venkatasubramanian >>> --- >>> libavformat/isom.h| 2 + >>> libavformat/mov.c | 41 ++- >>> tests/fate/mov.mak| 6 +++ >>> .../fate/mov-heic-demux-still-image-1-item| 11 + >>> .../mov-heic-demux-still-image-multiple-items | 11 + >>> 5 files changed, 70 insertions(+), 1 deletion(-) >>> create mode 100644 tests/ref/fate/mov-heic-demux-still-image-1-item >>> create mode 100644 tests/ref/fate/mov-heic-demux-still-image-multiple-items >>> >>> diff --git a/libavformat/isom.h b/libavformat/isom.h >>> index 3d375d7a46..b30b9da65e 100644 >>> --- a/libavformat/isom.h >>> +++ b/libavformat/isom.h >>> @@ -327,6 +327,8 @@ typedef struct MOVContext { >>> int64_t extent_offset; >>> } *avif_info; >>> int avif_info_size; >>> +int64_t hvcC_offset; >>> +int hvcC_size; >>> int interleaved_read; >>> } MOVContext; >>> >>> diff --git a/libavformat/mov.c b/libavformat/mov.c >>> index 294c864fbd..d3747022bd 100644 >>> --- a/libavformat/mov.c >>> +++ b/libavformat/mov.c >>> @@ -1218,7 +1218,8 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext >>> *pb, MOVAtom atom) >>> c->isom = 1; >>> av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char >>> *)&type); >>> av_dict_set(&c->fc->metadata, "major_brand", type, 0); >>> -c->is_still_picture_avif = !strncmp(type, "avif", 4); >>> +c->is_still_picture_avif = !strncmp(type, "avif", 4) || >>> + !strncmp(type, "mif1", 4); >>> minor_ver = avio_rb32(pb); /* minor version */ >>> av_dict_set_int(&c->fc->metadata, "minor_version", minor_ver, 0); >>> >>> @@ -4911,6 +4912,19 @@ static int avif_add_stream(MOVContext *c, int >>> item_id) >>> st->priv_data = sc; >>> st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; >>> st->codecpar->codec_id = AV_CODEC_ID_AV1; >>> +if (c->hvcC_offset >= 0) { >>> +int ret; >>> +int64_t pos = avio_tell(c->fc->pb); >>> +st->codecpar->codec_id = AV_CODEC_ID_HEVC; >>> +if (avio_seek(c->fc->pb, c->hvcC_offset, SEEK_SET) != >>> c->hvcC_offset) { >>> +av_log(c->fc, AV_LOG_ERROR, "Failed to seek to hvcC data.\n"); >>> +return AVERROR_UNKNOWN; >>> +} >>> +ret = ff_get_extradata(c->fc, st->codecpar, c->fc->pb, >>> c->hvcC_size); >>> +if (ret < 0) >>> +return ret; >>> +avio_seek(c->fc->pb, pos, SEEK_SET); >>> +} >>> sc->ffindex = st->index; >>> c->trak_index = st->index; >>> st->avg_frame_rate.num = st->avg_frame_rate.den = 1; >>> @@ -4953,6 +4967,8 @@ static int avif_add_stream(MOVContext *c, int item_id) >>> >>> static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) >>> { >>> +c->hvcC_offset = -1; >>> +c->hvcC_size = 0; >>> while (atom.size > 8) { >>> uint32_t tag; >>> if (avio_feof(pb)) >>> @@ -7827,6 +7843,28 @@ static int mov_read_iloc(MOVContext *c, AVIOContext >>> *pb, MOVAtom atom) >>> return atom.size; >>> } >>> >>> +static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) >>> +{ >>> +int size = avio_rb32(pb); >>> +if (avio_rl32(pb) != MKTAG('i','p','c','o')) >>> +return AVERROR_INVALIDDATA; >>> +size -= 8; >>> +while (size > 0) { >>> +int sub_size, sub_type; >>> +sub_size = avio_rb32(pb); >>> +sub_type = avio_rl32(pb); >>> +sub_size -= 8; >>> +size -= sub_size + 8; >>> +if (sub_type == MKTAG('h','v','c','C')) { >>> +c->hvcC_offset = avio_tell(pb); >>> +c->hvcC_size = sub_size; >>> +break; >>> +} >>> +avio_skip(pb, sub_size); >>> +} >>> +return atom.size; >>> +} >>> + >>> static const MOVParseTableEntry mov_default_parse_table[] = { >>> { MKTAG('A','C','L','R'), mov_read_aclr }, >>> { MKTAG('A','P','R','G'), mov_read_avid }, >>> @@ -7934,6 +7972,7 @@ static const MOVParseTableEntry >>> mov_default_parse_table[] = { >>> { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */ >>> { MKTAG('p','i','t','m'), mov_read_pitm },
[FFmpeg-devel] [RFC] SDR Vote
Hi all On VDD I was asked about (not) listing a release with SDR on the download page and IIRC the consensus was to do a vote on it. As you notice i am a bit hesitant to start a vote because its always better to find solutions evereyone is happy with and not just a majority. I also would prefer this vote to be done by someone neutral and not me but i failed to find a volunteer for that (and i tried). So if i have to make this vote, the plan would be to take the GA list of people posted in the last VDD mail. And use vote.ffmpeg.org (maybe make a test vote first, iam not sure) and then vote about the 2 main Questions, both independantly, they seem simple yes/no votes. The first Vote is, SDR in git master yes/no. (a no implies that i will maintain a seperate fork of FFmpeg with SDR) We could also make these 2 options more elaborate: * Two FFmpegs, one official FFmpeg without SDR. And one inofficial maintained by Michael with all features including the self contained SDR avdevice/demuxer. OR * One FFmpeg, including the self contained SDR avdevice/demuxer. (self contained SDR avdevice/demuxer.) is the code as it is in the libavradio repository that is currently: https://git.ffmpeg.org/gitweb/libavradio.git/commitdiff/886e4ed6521e288a5723a9896dc1cf96af127630?hp=a47afb80840e5ecd5eaf2d583e9a042805ad204a All suggested cleanup and fixes people might find, will of course be done before applying The 2nd question is *. Our download page shall only list the official FFmpeg release / repositories OR *. FFmpeg developers can list their maintained FFmpeg forks on the download page These shall be listed with some description and the name or alias of the maintainer(s). What about the external library? * No volunteer to design or even talk about the API, no volunteer to maintain seperate build system and testing infra. * Inconvenient at this stage for developing the code, API/ABI gets too entangled into design decissions, so internal design has to settle down first IMO. OR API has to be very high level but then its a clone of avdevice API and some people opposed that too. so its git master or fork or sdr code dies really and i dont want the code to die and so we end with this RFC, and if noone comes up with a practical/realistic alternative then a vote. A problem is that there is a divide between the developers making decissions about the SDR code (for example asking for an external library) and the developers working on the SDR code. This is a difficult setup. Normally we have people maintaining / working on / being affected by / being the authors of some code making decissions about it. Thx -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [6.0] Segmentation fault in graph_parse() (was: [PATCH 2/2] fftools/ffmpeg_filter: initialize the) 'o' to silence the warning
On Saturday, 25 February 2023 at 18:49, Thilo Borgmann wrote: > Am 25.02.23 um 16:26 schrieb Jun Zhao: > > From: Jun Zhao > > > > silence the warning: variable 'o' is used uninitialized whenever > > '&&' condition is false > > > > Signed-off-by: Jun Zhao > > --- > > fftools/ffmpeg_filter.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > LGTM. Sorry to dig up an old thread, but this actually fixes a segmentation fault when passing a non-existent filter option, so please make sure it's back-ported to the next 6.0.x release. To reproduce: ffmpeg -y -f rawvideo -s 1x1 -i /dev/zero -vf palettegen=doesnt_exist=64 dummy.png This was reported in RPM Fusion bugzilla: https://bugzilla.rpmfusion.org/show_bug.cgi?id=6773 5.1.3 is not affected, only 6.0. Regards, Dominik -- Fedora https://fedoraproject.org There should be a science of discontent. People need hard times and oppression to develop psychic muscles. -- from "Collected Sayings of Muad'Dib" by the Princess Irulan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avcodec/h264idct_template: Don't include h264dec.h
It is only needed for scan8 which is in h264_parse.h. Signed-off-by: Andreas Rheinhardt --- libavcodec/h264idct_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index ec0b428c27..db19b5f9fb 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -27,7 +27,7 @@ #include "bit_depth_template.c" #include "libavutil/common.h" -#include "h264dec.h" +#include "h264_parse.h" #include "h264idct.h" void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avcodec/error_resilience: Constify ThreadFrame*
Forgotten in 0eb399ac3953da16f880a1e455bb009a45f76d49. While just at it, also use a forward declaration. Signed-off-by: Andreas Rheinhardt --- libavcodec/error_resilience.h | 3 +-- libavcodec/h264dec.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h index b03f8ec896..1346639c3c 100644 --- a/libavcodec/error_resilience.h +++ b/libavcodec/error_resilience.h @@ -24,7 +24,6 @@ #include "avcodec.h" #include "me_cmp.h" -#include "threadframe.h" ///< current MB is the first after a resync marker #define VP_START 1 @@ -40,7 +39,7 @@ typedef struct ERPicture { AVFrame *f; -ThreadFrame *tf; +const struct ThreadFrame *tf; // it is the caller's responsibility to allocate these buffers int16_t (*motion_val[2])[2]; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index b4ea0ed880..0009b539e7 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -43,6 +43,7 @@ #include "h264qpel.h" #include "h274.h" #include "mpegutils.h" +#include "threadframe.h" #include "videodsp.h" #define H264_MAX_PICTURE_COUNT 36 -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/h264dec: Constify H.264 decoder
Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_cavlc.c | 2 +- libavcodec/h264_direct.c | 6 +++--- libavcodec/h264_picture.c | 6 +++--- libavcodec/h264_refs.c| 7 --- libavcodec/h264_slice.c | 23 +++ libavcodec/h264dec.c | 4 ++-- libavcodec/h264dec.h | 6 +++--- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index a06b775422..de223611c6 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -282,7 +282,7 @@ static int8_t cavlc_level_tab[7][1ref_list[0][i].poc; @@ -83,7 +83,7 @@ static void fill_colmap(const H264Context *h, H264SliceContext *sl, int map[2][16 + 32], int list, int field, int colfield, int mbafi) { -H264Picture *const ref1 = sl->ref_list[1][0].parent; +const H264Picture *const ref1 = sl->ref_list[1][0].parent; int j, old_ref, rfield; int start = mbafi ? 16 : 0; int end= mbafi ? 16 + 2 * sl->ref_count[0] : sl->ref_count[0]; @@ -150,7 +150,7 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext * if (h->picture_structure == PICT_FRAME) { int cur_poc = h->cur_pic_ptr->poc; -int *col_poc = sl->ref_list[1][0].parent->field_poc; +const int *col_poc = sl->ref_list[1][0].parent->field_poc; if (col_poc[0] == INT_MAX && col_poc[1] == INT_MAX) { av_log(h->avctx, AV_LOG_ERROR, "co located POCs unavailable\n"); sl->col_parity = 1; diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index 9353e4b445..c3726059f7 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -94,7 +94,7 @@ static void h264_copy_picture_params(H264Picture *dst, const H264Picture *src) dst->needs_fg = src->needs_fg; } -int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) +int ff_h264_ref_picture(H264Context *h, H264Picture *dst, const H264Picture *src) { int ret, i; @@ -194,7 +194,7 @@ fail: return ret; } -void ff_h264_set_erpic(ERPicture *dst, H264Picture *src) +void ff_h264_set_erpic(ERPicture *dst, const H264Picture *src) { #if CONFIG_ERROR_RESILIENCE int i; @@ -240,7 +240,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } else if (!in_setup && cur->needs_fg && (!FIELD_PICTURE(h) || !h->first_field)) { -AVFrameSideData *sd = av_frame_get_side_data(cur->f, AV_FRAME_DATA_FILM_GRAIN_PARAMS); +const AVFrameSideData *sd = av_frame_get_side_data(cur->f, AV_FRAME_DATA_FILM_GRAIN_PARAMS); err = AVERROR_INVALIDDATA; if (sd) // a decoding error may have happened before the side data could be allocated diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 1b24c493df..55f7255f01 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -48,7 +48,7 @@ static void pic_as_field(H264Ref *pic, const int parity) pic->poc = pic->parent->field_poc[parity == PICT_BOTTOM_FIELD]; } -static void ref_from_h264pic(H264Ref *dst, H264Picture *src) +static void ref_from_h264pic(H264Ref *dst, const H264Picture *src) { memcpy(dst->data, src->f->data, sizeof(dst->data)); memcpy(dst->linesize, src->f->linesize, sizeof(dst->linesize)); @@ -58,7 +58,8 @@ static void ref_from_h264pic(H264Ref *dst, H264Picture *src) dst->parent = src; } -static int split_field_copy(H264Ref *dest, H264Picture *src, int parity, int id_add) +static int split_field_copy(H264Ref *dest, const H264Picture *src, +int parity, int id_add) { int match = !!(src->reference & parity); @@ -275,7 +276,7 @@ static void h264_fill_mbaff_ref_list(H264SliceContext *sl) int list, i, j; for (list = 0; list < sl->list_count; list++) { for (i = 0; i < sl->ref_count[list]; i++) { -H264Ref *frame = &sl->ref_list[list][i]; +const H264Ref *frame = &sl->ref_list[list][i]; H264Ref *field = &sl->ref_list[list][16 + 2 * i]; field[0] = *frame; diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 27428dea33..1311ea0437 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -266,7 +266,7 @@ fail: return (ret < 0) ? ret : AVERROR(ENOMEM); } -static int find_unused_picture(H264Context *h) +static
[FFmpeg-devel] [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element
Split ff_cbs_trace_syntax_element from ff_cbs_trace_read_log to decouple the tracing from GetBitContext. This allows CBS implementations that do not have a GetBitContext to directly use ff_cbs_trace_syntax_element to trace syntax elements. Signed-off-by: Jianhui Dai --- libavcodec/cbs.c | 41 +-- libavcodec/cbs_internal.h | 4 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index cdd7adebeb..2f2cfcfb31 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -498,26 +498,18 @@ void ff_cbs_trace_header(CodedBitstreamContext *ctx, av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); } -void ff_cbs_trace_read_log(void *trace_context, - GetBitContext *gbc, int length, - const char *str, const int *subscripts, - int64_t value) +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + const char *str, const int *subscripts, + const char *bits, int64_t value) { -CodedBitstreamContext *ctx = trace_context; char name[256]; -char bits[256]; size_t name_len, bits_len; int pad, subs, i, j, k, n; -int position; - -av_assert0(value >= INT_MIN && value <= UINT32_MAX); -position = get_bits_count(gbc); +if (!ctx->trace_enable) +return; -av_assert0(length < 256); -for (i = 0; i < length; i++) -bits[i] = get_bits1(gbc) ? '1' : '0'; -bits[length] = 0; +av_assert0(value >= INT_MIN && value <= UINT32_MAX); subs = subscripts ? subscripts[0] : 0; n = 0; @@ -545,7 +537,7 @@ void ff_cbs_trace_read_log(void *trace_context, av_assert0(n == subs); name_len = strlen(name); -bits_len = length; +bits_len = strlen(bits); if (name_len + bits_len > 60) pad = bits_len + 2; @@ -556,6 +548,25 @@ void ff_cbs_trace_read_log(void *trace_context, position, name, pad, bits, value); } +void ff_cbs_trace_read_log(void *trace_context, + GetBitContext *gbc, int length, + const char *str, const int *subscripts, + int64_t value) +{ +CodedBitstreamContext *ctx = trace_context; +char bits[256]; +int position; + +position = get_bits_count(gbc); + +av_assert0(length < 256); +for (int i = 0; i < length; i++) +bits[i] = get_bits1(gbc) ? '1' : '0'; +bits[length] = 0; + +ff_cbs_trace_syntax_element(ctx, position, str, subscripts, bits, value); +} + void ff_cbs_trace_write_log(void *trace_context, PutBitContext *pbc, int length, const char *str, const int *subscripts, diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h index 07220f1f3e..ff90ce467d 100644 --- a/libavcodec/cbs_internal.h +++ b/libavcodec/cbs_internal.h @@ -158,6 +158,10 @@ typedef struct CodedBitstreamType { void ff_cbs_trace_header(CodedBitstreamContext *ctx, const char *name); +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, + const char *name, const int *subscripts, + const char *bitstring, int64_t value); + // Helper functions for read/write of common bitstream elements, including // generation of trace output. The simple functions are equivalent to -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element
> -Original Message- > From: Dai, Jianhui J > Sent: Tuesday, October 10, 2023 10:57 AM > To: ffmpeg-devel@ffmpeg.org > Subject: [PATCH v1] avcodec/cbs: Keep ff_cbs_trace_syntax_element > > Split ff_cbs_trace_syntax_element from ff_cbs_trace_read_log to decouple the > tracing from GetBitContext. This allows CBS implementations that do not have a > GetBitContext to directly use ff_cbs_trace_syntax_element to trace syntax > elements. > > Signed-off-by: Jianhui Dai > --- > libavcodec/cbs.c | 41 +-- > libavcodec/cbs_internal.h | 4 > 2 files changed, 30 insertions(+), 15 deletions(-) > > diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index cdd7adebeb..2f2cfcfb31 > 100644 > --- a/libavcodec/cbs.c > +++ b/libavcodec/cbs.c > @@ -498,26 +498,18 @@ void ff_cbs_trace_header(CodedBitstreamContext > *ctx, > av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); } > > -void ff_cbs_trace_read_log(void *trace_context, > - GetBitContext *gbc, int length, > - const char *str, const int *subscripts, > - int64_t value) > +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, > + const char *str, const int *subscripts, > + const char *bits, int64_t value) > { > -CodedBitstreamContext *ctx = trace_context; > char name[256]; > -char bits[256]; > size_t name_len, bits_len; > int pad, subs, i, j, k, n; > -int position; > - > -av_assert0(value >= INT_MIN && value <= UINT32_MAX); > > -position = get_bits_count(gbc); > +if (!ctx->trace_enable) > +return; > > -av_assert0(length < 256); > -for (i = 0; i < length; i++) > -bits[i] = get_bits1(gbc) ? '1' : '0'; > -bits[length] = 0; > +av_assert0(value >= INT_MIN && value <= UINT32_MAX); > > subs = subscripts ? subscripts[0] : 0; > n = 0; > @@ -545,7 +537,7 @@ void ff_cbs_trace_read_log(void *trace_context, > av_assert0(n == subs); > > name_len = strlen(name); > -bits_len = length; > +bits_len = strlen(bits); > > if (name_len + bits_len > 60) > pad = bits_len + 2; > @@ -556,6 +548,25 @@ void ff_cbs_trace_read_log(void *trace_context, > position, name, pad, bits, value); } > > +void ff_cbs_trace_read_log(void *trace_context, > + GetBitContext *gbc, int length, > + const char *str, const int *subscripts, > + int64_t value) { > +CodedBitstreamContext *ctx = trace_context; > +char bits[256]; > +int position; > + > +position = get_bits_count(gbc); > + > +av_assert0(length < 256); > +for (int i = 0; i < length; i++) > +bits[i] = get_bits1(gbc) ? '1' : '0'; > +bits[length] = 0; > + > +ff_cbs_trace_syntax_element(ctx, position, str, subscripts, bits, > +value); } > + > void ff_cbs_trace_write_log(void *trace_context, > PutBitContext *pbc, int length, > const char *str, const int *subscripts, diff > --git > a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h index > 07220f1f3e..ff90ce467d 100644 > --- a/libavcodec/cbs_internal.h > +++ b/libavcodec/cbs_internal.h > @@ -158,6 +158,10 @@ typedef struct CodedBitstreamType { void > ff_cbs_trace_header(CodedBitstreamContext *ctx, > const char *name); > > +void ff_cbs_trace_syntax_element(CodedBitstreamContext *ctx, int position, > + const char *name, const int *subscripts, > + const char *bitstring, int64_t value); > + > > // Helper functions for read/write of common bitstream elements, including > // > generation of trace output. The simple functions are equivalent to @Mark Thompson Could you please take a look if it's a valid change based on your last refactor? It's intended to use for the reviewing cbs_vp8 patch. > -- > 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [REFUND-REQUEST]] VDD23 Travel
On date Sunday 2023-10-08 10:09:03 +0800, Steven Liu wrote: > Nice to see you all after so long. > My request is for my flights, 9750,00 CNY Beijing from/to Abu Dhabi, > Abu Dhabi from/to Dublin Approved on my side, pending Michael's approval. To get the refund, follow instructions here to generate a refund request: https://www.spi-inc.org/treasurer/reimbursement-form/ When doing so, keep in mind that the XE Travel Expenses Calculator service mentioned in step 2 is not active anymore - just attach the receipts to the email. Then email it to: treasu...@rt.spi-inc.org putting me and Michael in CC:, and adding the thread link from: http://ffmpeg.org/pipermail/ffmpeg-devel/ Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".