Rewrite data - VLC became High-end media player

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Rewrite data - VLC became High-end media player

Post by oryaaaaa »

Rewrite data

As I continued to research and development of sound player, I will notice that the transfer method
of the memory changes the sound quality in the MMX and SSE and AVX. Memory output circuit of
the CPU, when it was thought to change by the CPU instructions and register, I found the answer
to the sound quality is of course changed. By the hypothesis grounds, it was named the technique
of new jitter suppression. "Rewrite memory"

"This is to achieve low jitter in all sound player"

Target: extension ( A=a )
"WAV", "MP3", "OGG", "FLAC", "APE", "M4A", "AAC", "WMA", "WV", "OPUS",
"DSF", "DFF", "M4P", "TAK", "TKK", "AIF", "AIFF", "AA3", "OMG", "OMA", "AC3"
"OGA" , "WSD", "MP2", "TTA"

Target [Shift + v]: extension ( A=a )
"MP4", "M4V", "WMV", "AVI", "MPG", "DIVX", "MOV", "MPEG", "VOB", "OGM",
"FLV", "ISO", "JPG", "DV", "MKV", "DTS", "ASF", "3GP", "3G2" , "SWF", "AMC",
"PNG", "BMP", "RM", "MTS", "M2TS", "MDS", "PSD", "TIF", "TIFF", "EPS", "AI",
"ARC"

Target [Shift + v] [Shift + c]: \User\[Name]\Donwloads\ (or \Downloads\)
*.*
---
Graphics drivers setup.exe
Sound drivers setup.exe
Game setup.exe
etc

"Run as administrator" : folders
[Bug head Emperor] Program files\Bug head Emperor
[VLC] Program files (x86)\VideoLAN
[Chrome] Program files (x86)\Google\Chrome
[foobar] Program Files (x86)\foobar2000
[Winamp] Program Files (x86)\Winamp
[AIMP3] Program Files (x86)\AIMP3

Try Rewrite data.
1. Rewrite for VLC software, and check improved quality.
2. Rewrite for Video files, and check improved quality.
3. Rewrite for Graphics driver, and check improved quality.
4. Rewrite for iTunes m4a m4p files, and check improved quality.
5. Rewrite for Google chrome software, and check improved quality.


Download - Rewrite data (x64, Installer)
* please watch "How to Rewrite data"
http://oryaaaaa.world.coocan.jp/bughead/


demo source code:

Code: Select all

; Rewrite data
; Copyright : Hiroyuki Yokota

Procedure InitBuffer()
  Shared *buffer
  Protected *b
  
  *buffer = AllocateMemory(8192, #PB_Memory_NoClear)
  *b = *buffer
  
  CompilerSelect #PB_Compiler_Processor
    CompilerCase #PB_Processor_x86
      !PXOR mm5, mm5
      !MOV Eax, 8192
      !MOV Ecx, [p.p_b]
      !InitializeMemory:
      !PXOR mm5, mm5
      !movntq [Ecx], mm5
      !ADD  Ecx, 8
      !SUB  Eax, 8
      !JNZ InitializeMemory
      !emms
    CompilerCase #PB_Processor_x64
      !PXOR mm5, mm5
      !MOV Rax, 8192
      !MOV Rcx, [p.p_b]
      !InitializeMemory: 
      !PXOR mm5, mm5
      !movntq [Rcx], mm5
      !ADD  Rcx, 8
      !SUB  Rax, 8
      !JNZ InitializeMemory
      !emms
  CompilerEndSelect 
  
EndProcedure

Procedure ReWriteMemory(*in_buf, in_pos.i)
  Protected s.i
  
  If in_pos%8>0
    s = in_pos + (8 - in_pos%8)
  Else
    s = in_pos
  EndIf
  
  If s < 1
    ProcedureReturn
  EndIf 
  
  CompilerSelect #PB_Compiler_Processor
    CompilerCase #PB_Processor_x86
      !PXOR mm5, mm5
      !MOV Eax, [p.v_s]
      !MOV Ecx, [p.p_in_buf]
      !ReWrite:
      !PXOR mm5, mm5
      !movq mm5, [Ecx]
      !movntq [Ecx], mm5
      !ADD  Ecx, 8
      !SUB  Eax, 8
      !JNZ ReWrite
      !emms
      ProcedureReturn
    CompilerCase #PB_Processor_x64
      !PXOR mm5, mm5
      !MOV Rax, [p.v_s]
      !MOV Rcx, [p.p_in_buf]
      !ReWrite:
      !PXOR mm5, mm5
      !movq mm5, [Rcx]
      !movntq [Rcx], mm5
      !ADD  Rcx, 8
      !SUB  Rax, 8
      !JNZ ReWrite
      !emms
      ProcedureReturn
  CompilerEndSelect 
   
EndProcedure

Procedure ReWriteData()
  Shared *buffer
  Protected FileName.s, file_id.l, pos.i, file_id_2.l
  
  FileName = OpenFileRequester("Rewrite data", "*.*", "*.*", 0)
  
  If FileSize(FileName)>0
    file_id = ReadFile(#PB_Any, FileName) : file_id_2 = CreateFile(#PB_Any, GetPathPart(FileName)+GetFilePart(FileName,#PB_FileSystem_NoExtension)+"_rw."+GetExtensionPart(FileName))
    While Eof(file_id) = 0
      pos = ReadData(file_id, *buffer, 8192)
      If pos>0
        ReWriteMemory(*buffer, pos)
        WriteData(file_id_2, *buffer, pos)
      Else
        CloseFile(file_id) : CloseFile(file_id_2)
        MessageRequester("Error", "Don't read file")
        End
      EndIf
    Wend
    CloseFile(file_id) : CloseFile(file_id_2)
  EndIf
  MessageRequester("Success", GetFilePart(FileName) ) 
  
EndProcedure

CompilerIf #PB_Compiler_OS = #PB_Compiler_Unicode
  InitBuffer()
  ReWriteData()
CompilerEndIf

infratec
Always Here
Always Here
Posts: 7600
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Rewrite data - VLC became High-end media player

Post by infratec »

Hi,

I just made a short test:
The new created file is identical to the old one. (With my test files)
If it is the same with your files, I think the jitter is more a problem of fragmented files.
Maybe you get the same 'jitter free' effect if you simply copy the file to a new destination.
Maybe it is even more better to copy the files to play to a RAM disk. (only an idea)

Bernd
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Re: Rewrite data - VLC became High-end media player

Post by oryaaaaa »

Thank you.

It is not a problem of fragmentation. AVX, MMX, SSE, quality will change by
the instruction. This is also effective in the buffer processing of sound player,
and improve sound quality. Also, I tested the RAMDISK, sound quality is very poor.

New version 1.16

add two mode
AVX ... Strong
MMX ... Normal
SSE ... SSE < MMX
NFX ... NFX < SSE
If you think that it is an improvement of this defragmentation, there is no change.
Post Reply