草庐IT

avcodec_alloc_context

全部标签

c++ - 什么是 "allocation context"?

我是一名学生,我必须进行有关内存泄漏检测的研究。在许多论文中,他们都在谈论分配背景。我不知道这是什么意思。我找不到任何allocationcontext的定义(或翻译,我来自德国)。举个例子,引用一篇论文(DetectingMemoryLeaksthroughIntrospectiveDynamic使用机器学习的行为建模):Thekeyideabehindusingmachinelearningisthataleakingobjectisdiscerniblebyobservingthelifetimesofothersimilarobjects.Thatis,anobjectcanb

c++ - boost::asio::yield_context:意外的 forced_unwind 异常

我正在尝试为boost::asio编写自定义异步函数,如here所述.但是我在result.get上遇到了boost::coroutines::detail::forced_unwind异常#include#include#include#include#includenamespaceasio=::boost::asio;templateautomy_timer(Timer&timer,Token&&token){typenameasio::handler_type::typehandler(std::forward(token));asio::async_resultresult(

c++ - Boost 库中的 Io_context 错误

我正在尝试使用BoostLibraries构建聊天室。但是当我尝试使用asio::io_context时,编译器说:io_contextisnotanmemberofasio.我构建了4次Boost,我认为问题可能是由于我的安装失败造成的,但事实并非如此。#include#include#include#include#include#include#includeusingboost::asio::ip::tcp;std::stringmake_daytime_string(){usingnamespacestd;//Fortime_t,timeandctime;time_tnow=

c++ - "single allocation"对 boost::make_shared 意味着什么

在make_shared的boost文档中,它说:Besidesconvenienceandstyle,suchafunctionisalsoexceptionsafeandconsiderablyfasterbecauseitcanuseasingleallocationforboththeobjectanditscorrespondingcontrolblock,eliminatingasignificantportionofshared_ptr'sconstructionoverhead.我不明白“单一分配”的意思,是什么意思? 最佳答案

c++ - 为什么 `polymorphic_allocator` 采用 `memory_resource` 指针而不是引用?

C++17标准说:[mem.poly.allocator.ctor]polymorphic_allocator(memory_resource*r);Requires:risnon-null.Effects:Setsmemory_­rsrctor.Throws:Nothing.[ Note:Thisconstructorprovidesanimplicitconversionfrommemory_­resource*.— endnote ]接受memory_resource*有什么意义?而不是memory_resource&如果“需要”子句提到r必须是非空的?Bloomberg¹风格指

c++ - 使用 Howard Hinnant 的 short_alloc 进行快速 move 分配

我正在使用HowardHinnant的漂亮的基于竞技场的小分配器,short_alloc.令我震惊的是,从vector进行的move分配可以使用通常的快速move分配(即获取目标的资源)来完成,该vector已经超出其arena,因此分配在堆上。然而,事实并非如此:typedefarenaarena_type;typedefshort_allocalloc_type;typedefstd::vectorvec_type;arena_typearena1,arena2;vec_typevec1(alloc_type(arena1)),vec2(alloc_type(arena2));ve

c++ - 'default-initialization in copy-initialization context' 在 C++ 中是什么意思?

例如,我想我理解直接初始化(与复制)上下文中的列表初始化意味着什么-intx{}与intx={}基本上。但是在cppreference我发现了这个:Whenanobjectofclasstypeiscopy-initializedfromanobjectofthesameorderivedclasstype,ordefault-initializedinacopy-initializationcontext,thecandidatefunctionsareallconvertingconstructorsoftheclassbeinginitialized.Theargumentlis

c++ - ffmpeg::avcodec_encode_video 设置 PTS h264

我正在尝试使用libavcodec将视频编码为H264ffmpeg::avcodec_encode_video(codec,output,size,avframe);返回一个错误,我没有正确设置avframe->pts值。我尝试将其设置为0,1、AV_NOPTS_VALUE和90khz*framenumber但仍然出现错误non-strictly-monotonicPTSffmpeg.c示例使用ffmpeg::av_rescale_q()设置packet.pts,但这仅在您对帧进行编码后调用!当与MP4V编解码器一起使用时,avcodec_encode_video()会自行正确设置pt

c++ - 多继承类自定义内存alloc和dealloc

我想在我的项目中进行内存管理。我不想要operatorglobalnew/delete所以我实现了一个简单的内存分配器。这是我的代码:classIAllocator{public:void*Alloc(unsignedintsize){1.allocmemory.2.tracealloc.}voidDealloc(void*ptr){1.freememory.2.erasetraceinfo.}templatevoidDestructor(T*ptr){if(ptr)ptr->~T();}};//macroforuseeasy.#defineMYNEW(T)new(g_Allocato

c++ - 容器优化:为什么 STL 容器方法参数不再使用 allocator::const_reference typedef?

阅读之前:const_reference是typedef,不需要是constT&正如您在std::vector::const_reference=bool中看到的那样.请在阅读其余部分时牢记这一点以正确理解它(正如评论中所建议的那样,这对很多人来说很难)。我想为简单类型(例如int)使用STL容器,但发现它们使用了次优的constT&“反模式”-它适用于大类,但在未内联时对于简单/基本类型不是最优的-考虑嵌入式系统,例如在ARM/ATSAM4L上,带有实例化。问题是:为什么例如vector::push_back使用(constvalue_type&)的参数重新设计而不是自C++11以来