libctru  v2.4.1
Data Structures | Macros | Enumerations | Functions
mvd.h File Reference

MVD service. More...

Go to the source code of this file.

Data Structures

struct  MVDSTD_Config
 Processing configuration. More...
 
struct  MVDSTD_ProcessNALUnitOut
 
struct  MVDSTD_OutputBuffersEntry
 
struct  MVDSTD_OutputBuffersEntryList
 
struct  MVDSTD_InitStruct
 This can be used to override the default input values for MVDSTD commands during initialization with video-processing. The default for these fields are all-zero, except for cmd1b_inval which is 1. See also here: https://www.3dbrew.org/wiki/MVD_Services. More...
 

Macros

#define MVD_STATUS_OK   0x17000
 These values are the data returned as "result-codes" by MVDSTD.
 
#define MVD_STATUS_PARAMSET   0x17001
 
#define MVD_STATUS_BUSY   0x17002
 
#define MVD_STATUS_FRAMEREADY   0x17003
 
#define MVD_STATUS_INCOMPLETEPROCESSING   0x17004
 
#define MVD_STATUS_NALUPROCFLAG   0x17007
 
#define MVD_CHECKNALUPROC_SUCCESS(x)   (x==MVD_STATUS_OK || x==MVD_STATUS_PARAMSET || x==MVD_STATUS_FRAMEREADY || x==MVD_STATUS_INCOMPLETEPROCESSING || x==MVD_STATUS_NALUPROCFLAG)
 This can be used to check whether mvdstdProcessVideoFrame() was successful.
 
#define MVD_DEFAULT_WORKBUF_SIZE   0x9006C8
 Default input size for mvdstdInit(). This is what the New3DS Internet Browser uses, from the MVDSTD:CalculateWorkBufSize output.
 

Enumerations

enum  MVDSTD_Mode {
  MVDMODE_COLORFORMATCONV ,
  MVDMODE_VIDEOPROCESSING
}
 Processing mode. More...
 
enum  MVDSTD_InputFormat {
  MVD_INPUT_YUYV422 = 0x00010001 ,
  MVD_INPUT_H264 = 0x00020001
}
 Input format. More...
 
enum  MVDSTD_OutputFormat {
  MVD_OUTPUT_YUYV422 = 0x00010001 ,
  MVD_OUTPUT_BGR565 = 0x00040002 ,
  MVD_OUTPUT_RGB565 = 0x00040004
}
 Output format. More...
 

Functions

Result mvdstdInit (MVDSTD_Mode mode, MVDSTD_InputFormat input_type, MVDSTD_OutputFormat output_type, u32 size, MVDSTD_InitStruct *initstruct)
 Initializes MVDSTD. More...
 
void mvdstdExit (void)
 Shuts down MVDSTD.
 
void mvdstdGenerateDefaultConfig (MVDSTD_Config *config, u32 input_width, u32 input_height, u32 output_width, u32 output_height, u32 *vaddr_colorconv_indata, u32 *vaddr_outdata0, u32 *vaddr_outdata1)
 Generates a default MVDSTD configuration. More...
 
Result mvdstdConvertImage (MVDSTD_Config *config)
 Run color-format-conversion. More...
 
Result mvdstdProcessVideoFrame (void *inbuf_vaddr, size_t size, u32 flag, MVDSTD_ProcessNALUnitOut *out)
 Processes a video frame(specifically a NAL-unit). More...
 
Result mvdstdRenderVideoFrame (MVDSTD_Config *config, bool wait)
 Renders the video frame. More...
 
Result MVDSTD_SetConfig (MVDSTD_Config *config)
 Sets the current configuration of MVDSTD. More...
 
Result mvdstdSetupOutputBuffers (MVDSTD_OutputBuffersEntryList *entrylist, u32 bufsize)
 New3DS Internet Browser doesn't use this. More...
 
Result mvdstdOverrideOutputBuffers (void *cur_outdata0, void *cur_outdata1, void *new_outdata0, void *new_outdata1)
 New3DS Internet Browser doesn't use this. More...
 

Detailed Description

MVD service.

Enumeration Type Documentation

◆ MVDSTD_InputFormat

Input format.

Enumerator
MVD_INPUT_YUYV422 

YUYV422.

MVD_INPUT_H264 

H264.

◆ MVDSTD_Mode

Processing mode.

Enumerator
MVDMODE_COLORFORMATCONV 

Converting color formats.

MVDMODE_VIDEOPROCESSING 

Processing video.

◆ MVDSTD_OutputFormat

Output format.

Enumerator
MVD_OUTPUT_YUYV422 

YUYV422.

MVD_OUTPUT_BGR565 

BGR565.

MVD_OUTPUT_RGB565 

RGB565.

Function Documentation

◆ MVDSTD_SetConfig()

Result MVDSTD_SetConfig ( MVDSTD_Config config)

Sets the current configuration of MVDSTD.

Parameters
configPointer to the configuration to set.

◆ mvdstdConvertImage()

Result mvdstdConvertImage ( MVDSTD_Config config)

Run color-format-conversion.

Parameters
configPointer to the configuration to use.
Examples
mvd/source/main.c.

◆ mvdstdGenerateDefaultConfig()

void mvdstdGenerateDefaultConfig ( MVDSTD_Config config,
u32  input_width,
u32  input_height,
u32  output_width,
u32  output_height,
u32 vaddr_colorconv_indata,
u32 vaddr_outdata0,
u32 vaddr_outdata1 
)

Generates a default MVDSTD configuration.

Parameters
configPointer to output the generated config to.
input_widthInput width.
input_heightInput height.
output_widthOutput width.
output_heightOutput height.
vaddr_colorconv_indataVirtual address of the color conversion input data.
vaddr_outdata0Virtual address of the output data.
vaddr_outdata1Additional virtual address for output data, only used when the output format type is value 0x00020001.
Examples
mvd/source/main.c.

◆ mvdstdInit()

Result mvdstdInit ( MVDSTD_Mode  mode,
MVDSTD_InputFormat  input_type,
MVDSTD_OutputFormat  output_type,
u32  size,
MVDSTD_InitStruct initstruct 
)

Initializes MVDSTD.

Parameters
modeMode to initialize MVDSTD to.
input_typeType of input to process.
output_typeType of output to produce.
sizeSize of the work buffer, MVD_DEFAULT_WORKBUF_SIZE can be used for this. Only used when type == MVDMODE_VIDEOPROCESSING.
initstructOptional MVDSTD_InitStruct, this should be NULL normally.
Examples
mvd/source/main.c.

◆ mvdstdOverrideOutputBuffers()

Result mvdstdOverrideOutputBuffers ( void *  cur_outdata0,
void *  cur_outdata1,
void *  new_outdata0,
void *  new_outdata1 
)

New3DS Internet Browser doesn't use this.

This overrides the entry0 output buffers originally setup by mvdstdSetupOutputBuffers(). See also here: https://www.3dbrew.org/wiki/MVDSTD:OverrideOutputBuffers

Parameters
cur_outdata0Linearmem vaddr. The current outdata0 for this entry must match this value.
cur_outdata1Linearmem vaddr. The current outdata1 for this entry must match this value.
new_outdata0Linearmem vaddr. This is the new address to use for outaddr0.
new_outdata1Linearmem vaddr. This is the new address to use for outaddr1.

◆ mvdstdProcessVideoFrame()

Result mvdstdProcessVideoFrame ( void *  inbuf_vaddr,
size_t  size,
u32  flag,
MVDSTD_ProcessNALUnitOut out 
)

Processes a video frame(specifically a NAL-unit).

Parameters
inbuf_vaddrInput NAL-unit starting with the 3-byte "00 00 01" prefix. Must be located in linearmem.
sizeSize of the input buffer.
flagSee here regarding this input flag: https://www.3dbrew.org/wiki/MVDSTD:ProcessNALUnit
outOptional output MVDSTD_ProcessNALUnitOut structure.
Examples
mvd/source/main.c.

◆ mvdstdRenderVideoFrame()

Result mvdstdRenderVideoFrame ( MVDSTD_Config config,
bool  wait 
)

Renders the video frame.

Parameters
configOptional pointer to the configuration to use. When NULL, MVDSTD_SetConfig() should have been used previously for this video.
waitWhen true, wait for rendering to finish. When false, you can manually call this function repeatedly until it stops returning MVD_STATUS_BUSY.
Examples
mvd/source/main.c.

◆ mvdstdSetupOutputBuffers()

Result mvdstdSetupOutputBuffers ( MVDSTD_OutputBuffersEntryList entrylist,
u32  bufsize 
)

New3DS Internet Browser doesn't use this.

Once done, rendered frames will be written to the output buffers specified by the entrylist instead of the output specified by configuration. See here: https://www.3dbrew.org/wiki/MVDSTD:SetupOutputBuffers

Parameters
entrylistInput entrylist.
bufsizeSize of each buffer from the entrylist.