ImgMedia.FrameInvalidationMaxCount

ImgMedia.FrameInvalidationMaxCount

#Overview

name: ImgMedia.FrameInvalidationMaxCount

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ImgMedia.FrameInvalidationMaxCount is to control the maximum number of cached frames that can be invalidated when missing the latest mips or tiles in the ImgMedia plugin for Unreal Engine 5.

This setting variable is primarily used in the ImgMedia plugin, which is part of Unreal Engine’s media framework. It specifically relates to the image sequence loading and caching mechanism within this plugin.

The value of this variable is set through a console variable (CVarImgMediaFrameInvalidationMaxCount) in the ImgMediaLoader.cpp file. It has a default value of 2.

The associated variable CVarImgMediaFrameInvalidationMaxCount interacts directly with ImgMedia.FrameInvalidationMaxCount. It’s a TAutoConsoleVariable that allows runtime modification of the setting.

Developers must be aware that this variable affects the performance and memory usage of the ImgMedia plugin. A higher value may improve image quality by allowing more frames to be invalidated and potentially reloaded with higher quality mips/tiles, but it could also increase memory usage and processing time.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the project, considering the trade-off between image quality and performance.
  2. Monitoring its impact on memory usage and frame rates, especially when dealing with high-resolution image sequences.
  3. Using it in conjunction with other ImgMedia settings for optimal performance.

Regarding the associated variable CVarImgMediaFrameInvalidationMaxCount:

This is a console variable that directly controls the ImgMedia.FrameInvalidationMaxCount setting. It’s defined in the ImgMediaLoader.cpp file and is used within the FImgMediaLoader::Update function.

The purpose of CVarImgMediaFrameInvalidationMaxCount is to provide a way to dynamically adjust the ImgMedia.FrameInvalidationMaxCount setting during runtime or through configuration files.

This variable is used in the ImgMedia plugin, specifically in the loader component of the plugin.

The value of CVarImgMediaFrameInvalidationMaxCount can be set through console commands or configuration files, allowing for easy adjustment without recompiling the engine.

Developers should be aware that changes to this variable will immediately affect the behavior of the ImgMedia plugin’s frame caching system.

Best practices for using CVarImgMediaFrameInvalidationMaxCount include:

  1. Using it for debugging or fine-tuning performance in different scenarios.
  2. Documenting any non-default values used in production to ensure consistency across development and deployment environments.
  3. Considering its impact on both visual quality and performance when adjusting its value.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Loader/ImgMediaLoader.cpp:37

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarImgMediaFrameInvalidationMaxCount(
	TEXT("ImgMedia.FrameInvalidationMaxCount"),
	2,
	TEXT("Maximum number of cached frames that can be invalidated when missing the latest mips/tiles."));

namespace ImgMediaLoader
{
	void CheckAndUpdateImgDimensions(FIntPoint& InOutSequenceDim, const FIntPoint& InNewDim)

#Associated Variable and Callsites

This variable is associated with another variable named CVarImgMediaFrameInvalidationMaxCount. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Loader/ImgMediaLoader.cpp:36

Scope: file

Source code excerpt:

constexpr int32 FImgMediaLoader::MAX_MIPMAP_LEVELS;

static TAutoConsoleVariable<int32> CVarImgMediaFrameInvalidationMaxCount(
	TEXT("ImgMedia.FrameInvalidationMaxCount"),
	2,
	TEXT("Maximum number of cached frames that can be invalidated when missing the latest mips/tiles."));

namespace ImgMediaLoader
{

#Loc: <Workspace>/Engine/Plugins/Media/ImgMedia/Source/ImgMedia/Private/Loader/ImgMediaLoader.cpp:1314

Scope (from outer to inner):

file
function     void FImgMediaLoader::Update

Source code excerpt:


	// Limit which frames can be invalidated for missing mips/tiles
	const int32 FrameInvalidationMaxCount = CVarImgMediaFrameInvalidationMaxCount.GetValueOnAnyThread();

	for (int32 FrameNumber : FramesToLoad)
	{
		// Get frame from cache.
		bool NeedFrame = false;
		const TSharedPtr<FImgMediaFrame, ESPMode::ThreadSafe>* FramePtr = GetCachedFrame(FrameNumber);