CrendKing / avisynth_filter

DirectShow filters that put AviSynth and VapourSynth into video playing
MIT License
108 stars 8 forks source link

Wrong conversion (?) to RGB24 #13

Closed chainikdn closed 3 years ago

chainikdn commented 3 years ago

The video: https://mega.nz/file/ZR9iDaqK#tMwyH_hufrhkxI617KYAjUtASGC5AuOSAMwgQbIYk0Q MPC-HC 64-bit, LAV decoder, madVR, AVSF 0.7.2, no SVP, no script in AVSF

  1. LAV decoder set to DXVA2-CP: normal playback, madVR shows "h264, 8 bit, 4:2:0 -> NV12, 8 bit, 4:2:0"
  2. LAV decoder set to CUVID: picture is grayscale, flipped vertically and resized to 1/4 of width. madVR shows "h264, 8 bit, 4:2:0 -> RGB24, 8 bit, RGB". "Avs In" - Connection media type: NV12 1024x576 23.976fps in both cases. Log:
    
    T  16372 @        0: Configured script file: 
    T  16372 @        0: Configured input formats: 2047
    T  16372 @        0: Configured output threads: 1
    T  16372 @        0: Loading process: C:\Program Files\MPC-HC\mpc-hc64.exe
    T  16372 @        0: CAviSynthFilter::CAviSynthFilter()
    T  16372 @        0: Filter version: 0.7.2
    T  16372 @        0: AviSynth version: AviSynth+ 3.5 (r3106, 3.5, x86_64)
    T  16372 @        0: ReloadAviSynthScript
    T  16372 @        0: Add acceptable input definition:  0
    T  16372 @        0: Add acceptable output definition:  0
    T  16372 @        0: Add compatible definitions: input  0 output  0
    T  16372 @        0: Add acceptable output definition:  1
    T  16372 @        0: Add compatible definitions: input  0 output  1
    T  16372 @        0: Add acceptable output definition:  2
    T  16372 @        0: Add compatible definitions: input  0 output  2
    T  16372 @        0: Add acceptable output definition:  3
    T  16372 @        0: Add compatible definitions: input  0 output  3
    T  16372 @        0: ReloadAviSynthScript
    T  16372 @        0: Add acceptable input definition:  4
    T  16372 @        0: Add acceptable output definition:  4
    T  16372 @        0: Add compatible definitions: input  4 output  4
    T  16372 @        0: Add acceptable output definition:  5
    T  16372 @        0: Add compatible definitions: input  4 output  5
    T  16372 @        0: ReloadAviSynthScript
    T  16372 @        0: Add acceptable input definition:  6
    T  16372 @        0: Add acceptable output definition:  6
    T  16372 @        0: Add compatible definitions: input  6 output  6
    T  16372 @        0: Add acceptable output definition:  7
    T  16372 @        0: Add compatible definitions: input  6 output  7
    T  16372 @        0: ReloadAviSynthScript
    T  16372 @        0: Add acceptable input definition:  9
    T  16372 @        0: Add acceptable output definition:  9
    T  16372 @        0: Add compatible definitions: input  9 output  9
    T  16372 @        0: ReloadAviSynthScript
    T  16372 @        0: Add acceptable input definition:  8
    T  16372 @        0: Add acceptable output definition:  8
    T  16372 @        0: Add compatible definitions: input  8 output  8
    T  16372 @        0: Accept input definition:  0
    T  16372 @        0: Connected input pin with definition:  0
    T  16372 @        0: Offer output definition:  0
    T  16372 @        0: Offer output definition:  1
    T  16372 @        0: Offer output definition:  2
    T  16372 @        0: Offer output definition:  3
    T  16372 @        0: Offer output definition:  4
    T  16372 @        0: Offer output definition:  5
    T  16372 @        0: Offer output definition:  6
    T  16372 @        0: Offer output definition:  7
    T  16372 @        0: Offer output definition:  9
    T  16372 @        0: Offer output definition:  8
    T  16372 @        1: CAviSynthFilter::CAviSynthFilter()
    T  16372 @        1: Frame handler begin flush
    T  16372 @        1: Frame handler cleanup after stop threads
    T  16372 @        1: Frame handler end flush
    T  16372 @       13: Offer output definition:  0
    T  16372 @       13: Accept transform: out  0
    T  16372 @       13: Offer output definition:  1
    T  16372 @       13: Accept transform: out  1
    T  16372 @       13: Offer output definition:  2
    T  16372 @       13: Accept transform: out  2
    T  16372 @       13: Offer output definition:  3
    T  16372 @       13: Accept transform: out  3
    T  16372 @       13: Offer output definition:  4
    T  16372 @       13: Accept transform: out  4
    T  16372 @       13: Offer output definition:  5
    T  16372 @       13: Accept transform: out  5
    T  16372 @       13: Offer output definition:  6
    T  16372 @       13: Accept transform: out  6
    T  16372 @       13: Offer output definition:  7
    T  16372 @       13: Accept transform: out  7
    T  16372 @       13: Offer output definition:  9
    T  16372 @       13: Accept transform: out  9
    T  16372 @       13: Offer output definition:  8
    T  16372 @       13: Accept transform: out  8
    T  16372 @       13: Offer output definition:  0
    T  16372 @       13: Accept transform: out  0
    T  16372 @       13: Offer output definition:  1
    T  16372 @       13: Accept transform: out  1
    T  16372 @       13: Offer output definition:  2
    T  16372 @       13: Accept transform: out  2
    T  16372 @       13: Offer output definition:  3
    T  16372 @       13: Accept transform: out  3
    T  16372 @       14: Offer output definition:  4
    T  16372 @       14: Accept transform: out  4
    T  16372 @       14: Offer output definition:  5
    T  16372 @       14: Accept transform: out  5
    T  16372 @       14: Offer output definition:  6
    T  16372 @       14: Accept transform: out  6
    T  16372 @       14: Offer output definition:  7
    T  16372 @       14: Accept transform: out  7
    T  16372 @       14: Offer output definition:  9
    T  16372 @       14: Accept transform: out  9
    T  16372 @       14: Offer output definition:  8
    T  16372 @       14: Accept transform: out  8
    T  16372 @       84: Offer output definition:  0
    T  16372 @       84: Accept transform: out  0
    T  16372 @       84: Accept transform: out  0
    T  16372 @      137: Connected with types: in  0 out  0
    T  16372 @      137: Offer output definition:  0
    T  16340 @      794: Visiting filter: LAV Splitter Source (internal)
    T  16340 @      794: Visiting filter: LAV Video Decoder (internal)
    T  16340 @      794: Visiting filter: AviSynth Filter
    T  16340 @      794: Visiting filter: madVR
    T  15648 @      795: Start output worker thread
    T  13104 @      800: Remote control started
    T  11964 @      875: Accept input definition:  0
    T  11964 @      875: Accept transform: out  0
    T  11964 @      875: Accept input definition:  0
    T  11964 @      875: Accept transform: out  0
    T  11964 @      875: Update output format using input format: definition 0, width  1024, height   576, codec NV12
    T  11964 @      875: Accept transform: out  8
    T  11964 @      875: Accept transform: out  8
    T  11964 @      876: Accept transform: out  8
    T  11964 @      876: Accept input definition:  0
    T  11964 @      876: Accept transform: out  0
    T  11964 @      876: Frame handler begin flush
    T  11964 @      876: Frame handler wait for barriers
    T  15648 @      876: Output worker thread wait for flush
    T  11964 @      876: Frame handler end flush
    T  11964 @      876: ReloadAviSynthScript
    T  11964 @      876: Update output format using input format: definition 0, width  1024, height   576, codec NV12
    T  11964 @      876: Accept transform: out  0
    T  11964 @      876: Accept transform: out  0
    T  11964 @      876: New output format: definition 8, width  1024, height  -576, codec RGB24
    T  11964 @      877: Processed source frame:      0 at      81250 ~     498333, nextSourceFrameNb      0 nextOutputFrameStartTime          0
    T  11964 @      877: New output format: definition 8, width  1024, height  -576, codec RGB24
    T  11964 @      878: Processed source frame:      1 at     491250 ~     908333, nextSourceFrameNb      1 nextOutputFrameStartTime          0
    T  11964 @      878: Create output frame      0 for source frame      0 at      81250 ~     491250
    T  15648 @      878: Start processing output frame      0 at      81250 ~     491250 frameTime     410000 for source      0 Output queue size  0 Front     -1 Back     -1
    T  15648 @      878: Get source frame: frameNb      0 Input queue size  2
    T  11964 @      878: New output format: definition 8, width  1024, height  -576, codec RGB24
    T  15648 @      879: Accept transform: out  8
    T  15648 @      879: Delivered frame      0
    T  15648 @      879: GarbageCollect frame      0 pre refcount    1 post queue size  2
    T  11964 @      879: Processed source frame:      2 at     911250 ~    1328333, nextSourceFrameNb      2 nextOutputFrameStartTime     491250
    T  11964 @      879: Create output frame      1 for source frame      1 at     491250 ~     911250
CrendKing commented 3 years ago

Fixed in https://github.com/CrendKing/avisynth_filter/commit/edd118391fd75c3ad1346409bbe99ff73004573f and v0.7.4.

This behavior seems to be specific to CUVID. As suggested by Nevcairiel, it has compatibility issues and users should usually use DXVA2 or D3D11.

chainikdn commented 3 years ago

I wonder why the AVSF output is switching to RGB24 in the first place? Don't you see an issue here? As to Nevcairiel's post - it's only related to HDR meta-data.

chainikdn commented 3 years ago

btw you didn't push the version number to 0.7.4


ah, ok, it doesn't switch to rgb24 anymore

CrendKing commented 3 years ago

I wonder why the AVSF output is switching to RGB24 in the first place? Don't you see an issue here?

I reproduced the problem and fixed it. It is small bug that requires several "stars" to line up to trigger. That's why I didn't experience it myself before.

it's only related to HDR meta-data.

I'm just provide one example of the issues of CUVID. It is deprecated. Just do a search in LAV. I also experience problems myself when using it.