wppaste
WordPress

getid3_mp3::LAMEpresetUsedLookup( array $LAMEtag ): string

Source
wp-includes/ID3/module.audio.mp3.php:2163

Compatibility

WordPress
core
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$LAMEtagarray

Return value

string

Performance profile

How much work a call to getid3_mp3::LAMEpresetUsedLookup() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Light

Touches nothing outside its own arguments.

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
5–90

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 116.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What one call costs · 1 distinct outcome

One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_mp3::LAMEpresetUsedLookup() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always5–90none

Across PHP versions

Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 116 instructions, 5–90 executed per call, 9 branches. The work does not change between versions.

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Used by · 1

Source code

	public static function LAMEpresetUsedLookup($LAMEtag) { 		if ($LAMEtag['preset_used_id'] == 0) {			// no preset used (LAME >=3.93)			// no preset recorded (LAME <3.93)			return '';		}		$LAMEpresetUsedLookup = array(); 		/////  THIS PART CANNOT BE STATIC .		for ($i = 8; $i <= 320; $i++) {			switch ($LAMEtag['vbr_method']) {				case 'cbr':					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i;					break;				case 'abr':				default: // other VBR modes shouldn't be here(?)					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$i;					break;			}		} 		// named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions() 		// named alt-presets		$LAMEpresetUsedLookup[1000] = '--r3mix';		$LAMEpresetUsedLookup[1001] = '--alt-preset standard';		$LAMEpresetUsedLookup[1002] = '--alt-preset extreme';		$LAMEpresetUsedLookup[1003] = '--alt-preset insane';		$LAMEpresetUsedLookup[1004] = '--alt-preset fast standard';		$LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme';		$LAMEpresetUsedLookup[1006] = '--alt-preset medium';		$LAMEpresetUsedLookup[1007] = '--alt-preset fast medium'; 		// LAME 3.94 additions/changes		$LAMEpresetUsedLookup[1010] = '--preset portable';                                                           // 3.94a15 Oct 21 2003		$LAMEpresetUsedLookup[1015] = '--preset radio';                                                              // 3.94a15 Oct 21 2003 		$LAMEpresetUsedLookup[320]  = '--preset insane';                                                             // 3.94a15 Nov 12 2003		$LAMEpresetUsedLookup[410]  = '-V9';		$LAMEpresetUsedLookup[420]  = '-V8';		$LAMEpresetUsedLookup[440]  = '-V6';		$LAMEpresetUsedLookup[430]  = '--preset radio';                                                              // 3.94a15 Nov 12 2003		$LAMEpresetUsedLookup[450]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable';  // 3.94a15 Nov 12 2003		$LAMEpresetUsedLookup[460]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium';    // 3.94a15 Nov 12 2003		$LAMEpresetUsedLookup[470]  = '--r3mix';                                                                     // 3.94b1  Dec 18 2003		$LAMEpresetUsedLookup[480]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard';  // 3.94a15 Nov 12 2003		$LAMEpresetUsedLookup[490]  = '-V1';		$LAMEpresetUsedLookup[500]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme';   // 3.94a15 Nov 12 2003 		return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to [email protected]');	}

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ID3/module.audio.mp3.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.