Nightly DXVA decoding broken

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Nightly DXVA decoding broken

Post by ashleylai87 »

I'm not sure which svn revision borked the dxva decoding.

I think the last revision where dxva decoding works was 6227.
Cause the GPUZ reporting 0% utilization for every video I tried to convert.
I am certain my videos is dxva specification compliant.

Win64-GUI.

Yes, the Enable DXVA decoding box is checked, I even unchecked and checked it just to make sure.
The log even confirmed no dxva decoding was used.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Nightly DXVA decoding broken

Post by s55 »

Firstly, Post the log otherwise we have no idea what is going on.

Secondly, DXVA won't always be used. It only supports a very small subset of decoders, and only on the libav code path. (so not used for disc based for example)

Edit: Had a look, seems to work for me on supported sources.
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

  • HandBrake svn6237 (Nightly Build) - 64bit Version
    OS: Microsoft Windows NT 6.1.7601 Service Pack 1
    CPU: Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
    Ram: 4094 MB,
    GPU Information:
    AMD Radeon HD 5450 - 14.200.1004.0
    Screen: 1440x900
    Temp Dir: C:\Users\Anonymous\AppData\Local\Temp\
    Install Dir: C:\Program Files\Handbrake
    Data Dir: C:\Users\Anonymous\AppData\Roaming\HandBrake\HandBrake\0.0.0.6237

    -------------------------------------------
    CLI Query: -i "D:\TEST.mkv" -t 1 --angle 1 --start-at duration:0 --stop-at duration:30 -o "D:\Test-1.mkv" -f mkv --decomb -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a none --audio-fallback ac3 --markers="C:\Users\Anonymous\AppData\Local\Temp\Test-1-1-chapters.csv" --encoder-preset=superfast --encoder-level="4.1" --encoder-profile=high --verbose=1 -P -U

    [00:31:17] hb_init: starting libhb thread
    HandBrake svn6237 (2014071801) - MinGW x86_64 - http://handbrake.fr
    4 CPUs detected
    Opening D:\TEST.mkv...
    [00:31:17] CPU: Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
    [00:31:17] - logical processor count: 4
    [00:31:17] OpenCL device #1: Advanced Micro Devices, Inc. Cedar
    [00:31:17] - OpenCL version: 1.2 AMD-APP (1526.3)
    [00:31:17] - driver version: 1526.3 (VM)
    [00:31:17] - device type: GPU
    [00:31:17] - supported: YES
    [00:31:17] Intel Quick Sync Video support: no
    [00:31:17] hb_scan: path=D:\TEST.mkv, title_index=1
    libbluray/bdnav/index_parse.c:162: indx_parse(): error opening D:\TEST.mkv/BDMV/index.bdmv
    libbluray/bdnav/index_parse.c:162: indx_parse(): error opening D:\TEST.mkv/BDMV/BACKUP/index.bdmv
    libbluray/bluray.c:2182: nav_get_title_list(D:\TEST.mkv) failed
    [00:31:17] bd: not a bd - trying as a stream/file instead
    libdvdnav: Using dvdnav version 5.0.0
    libdvdread: Encrypted DVD support unavailable.
    libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
    libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
    libdvdread: Can't open file VIDEO_TS.IFO.
    libdvdnav: vm: failed to read VIDEO_TS.IFO
    [00:31:17] dvd: not a dvd - trying as a stream/file instead
    Input #0, matroska,webm, from 'D:\TEST.mkv':
    Duration: 00:23:09.90, start: 0.000000, bitrate: 3199 kb/s
    Stream #0.0: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.81 fps, 1k tbn, 47.95 tbc (default) (forced)
    Stream #0.1: Audio: aac, 44100 Hz, stereo, fltp (default) (forced)
    Stream #0.2: Subtitle: ass (default) (forced)
    Stream #0.3: Attachment: [0][0][0][0] / 0x0000
    Metadata:
    filename : BAARS___.TTF
    mimetype : application/x-truetype-font
    [00:31:17] scan: decoding previews for title 1
    [00:31:17] scan: audio 0x1: aac, rate=44100Hz, bitrate=1 Unknown (AAC) (2.0 ch)
    Scanning title 1 of 1, preview 1, 10.00 %
    Scanning title 1 of 1, preview 4, 40.00 %
    Scanning title 1 of 1, preview 6, 60.00 %
    Scanning title 1 of 1, preview 9, 90.00 %[00:31:18] scan: 10 previews, 1920x1080, 23.810 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
    [00:31:18] libhb: scan thread found 1 valid title(s)
    + title 1:
    + stream: D:\TEST.mkv
    + duration: 00:23:09
    + size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.810 fps
    + autocrop: 0/0/0/0
    + support opencl: yes
    + support hwd: yes
    + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:23:09
    + audio tracks:
    + 1, Unknown (AAC) (2.0 ch) (iso639-2: und)
    + subtitle tracks:
    + 1, Unknown (iso639-2: und) (Text)(SSA)
    Reading chapter markers from file C:\Users\Anonymous\AppData\Local\Temp\Test-1-1-chapters.csv
    [00:31:18] 1 job(s) to process
    [00:31:19] starting job
    [00:31:19] yadif thread started for segment 0
    [00:31:19] yadif thread started for segment 1
    [00:31:19] yadif thread started for segment 2
    [00:31:19] yadif thread started for segment 3
    [00:31:19] decomb filter thread started for segment 0
    [00:31:19] decomb filter thread started for segment 1
    [00:31:19] decomb filter thread started for segment 2
    [00:31:19] decomb filter thread started for segment 3
    [00:31:19] decomb check thread started for segment 0
    [00:31:19] decomb check thread started for segment 1
    [00:31:19] decomb check thread started for segment 2
    [00:31:19] decomb check thread started for segment 3
    [00:31:19] mask filter thread started for segment 0
    [00:31:19] mask filter thread started for segment 1
    [00:31:19] mask filter thread started for segment 2
    [00:31:19] mask filter thread started for segment 3
    [00:31:19] mask erode thread started for segment 0
    [00:31:19] mask erode thread started for segment 1
    [00:31:19] mask erode thread started for segment 2
    [00:31:19] mask erode thread started for segment 3
    [00:31:19] mask dilate thread started for segment 0
    [00:31:19] mask dilate thread started for segment 1
    [00:31:19] mask dilate thread started for segment 2
    [00:31:19] mask dilate thread started for segment 3
    [00:31:19] sync: expecting 738 video frames
    [00:31:19] work: only 1 chapter, disabling chapter markers
    [00:31:19] job configuration:
    [00:31:19] * source
    [00:31:19] + D:\TEST.mkv
    [00:31:19] + title 1, start 00:00:0.00 stop 00:00:30.00
    [00:31:19] + container: matroska,webm
    [00:31:19] + data rate: 3199 kbps
    [00:31:19] * destination
    [00:31:19] + D:\Test-1.mkv
    [00:31:19] + container: Matroska (libavformat)
    [00:31:19] * video track
    [00:31:19] + decoder: h264
    [00:31:19] + filters
    [00:31:19] + Decomb (default settings)
    [00:31:19] + Framerate Shaper (0:27000000:1134000)
    [00:31:19] + frame rate: same as source (around 23.810 fps)
    [00:31:19] + Crop and Scale (1280:720:0:0:0:0)
    [00:31:19] + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1280 * 720
    [00:31:19] + loose anamorphic
    [00:31:19] + storage dimensions: 1280 * 720, mod 2
    [00:31:19] + pixel aspect ratio: 1 / 1
    [00:31:19] + display dimensions: 1280 * 720
    [00:31:19] + encoder: H.264 (libx264)
    [00:31:19] + preset: superfast
    [00:31:19] + profile: high
    [00:31:19] + level: 4.1
    [00:31:19] + quality: 20.00 (RF)
    [00:31:19] reader: first SCR 0 id 0x0 DTS 0
    [00:31:19] encx264: min-keyint: 24, keyint: 240
    [00:31:19] encx264: encoding at constant RF 20.000000
    [00:31:19] encx264: unparsed options: level=4.1:ref=1:analyse=i4x4,i8x8:weightp=1:me=dia:subme=1:mixed-refs=0:trellis=0:vbv-bufsize=78125:vbv-maxrate=62500:mbtree=0:rc-lookahead=0
    x264 [info]: using SAR=1/1
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
    x264 [info]: profile High, level 4.1
    [00:31:19] Scaling With OpenCL
    [00:31:19] Using Zero Copy
    [00:31:45] sync: reached pts 2702700, exiting early
    [00:31:47] work: average encoding speed for job is 27.046068 fps
    [00:31:47] mux: track 0, 714 frames, 19190232 bytes, 5119.44 kbps, fifo 512
    [00:31:47] sync: got 715 frames, 738 expected
    [00:31:47] decomb: deinterlaced 0 | blended 1 | unfiltered 713 | total 714
    [00:31:47] reader: done. 1 scr changes
    [00:31:47] render: lost time: 0 (0 frames)
    [00:31:47] render: gained time: 0 (0 frames) (0 not accounted for)
    [00:31:47] h264-decoder done: 875 frames, 0 decoder errors, 0 drops
    x264 [info]: frame I:4 Avg QP:11.10 size:112439
    x264 [info]: frame P:319 Avg QP:13.36 size: 40020
    x264 [info]: frame B:391 Avg QP:15.97 size: 15279
    x264 [info]: consecutive B-frames: 17.1% 25.8% 11.8% 45.4%
    x264 [info]: mb I I16..4: 22.5% 46.3% 31.2%
    x264 [info]: mb P I16..4: 15.5% 13.0% 3.7% P16..4: 54.3% 0.0% 0.0% 0.0% 0.0% skip:13.6%
    x264 [info]: mb B I16..4: 2.0% 1.7% 0.8% B16..8: 29.3% 0.0% 0.0% direct:16.8% skip:49.5% L0:37.7% L1:48.5% BI:13.8%
    x264 [info]: 8x8 transform intra:40.3% inter:22.7%
    x264 [info]: coded y,uvDC,uvAC intra: 50.0% 69.8% 58.4% inter: 22.4% 25.0% 6.2%
    x264 [info]: i16 v,h,dc,p: 65% 16% 16% 3%
    x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 16% 27% 5% 7% 6% 6% 5% 5%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 19% 13% 6% 5% 7% 5% 6% 5%
    x264 [info]: i8c dc,h,v,p: 51% 19% 23% 8%
    x264 [info]: Weighted P-Frames: Y:5.0% UV:2.2%
    x264 [info]: kb/s:5119.49
    [00:31:47] libhb: work result = 0
    Encode done!
    HandBrake has exited.
Last time, I think there was something about 'dxva' term in the log, but it is missing now.


EDIT: forget to set the setting for downscaling to 720p. Note, I exclude audio and subtitle from the transcode.
Last edited by ashleylai87 on Sun Jul 20, 2014 4:35 pm, edited 2 times in total.
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

In case the information of my test file is needed, from mediainfo :

x264 core 120 r2120
Encoding settings : cabac=1 / ref=4 / deblock=1:1:1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=8 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=3072 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=6144 / vbv_bufsize=15360 / nal_hrd=none / ip_ratio=1.40 / aq=1:0.60
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

Huh? I just noticed when bicubic (opencl) is used, the output video is very pixelated, like literally. Several build ago, it was working fine.
When switched back to lanczos, it is perfectly normal and smooth.

EDIT: I think one of the user from this thread viewtopic.php?f=6&t=30429 also experience the resizing issue caused by bicubic (opencl) rescaling. Except his log indicate the dxva still working.......
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

Bumping the bug.....Anyone who is willing to fix the DXVA bug?
If anyone notice, during svn6207 nightly, DXVA is still working with the following log on the same file;

dxva2:CreateSurface succeed with 3, fmt (1280x720) surfaces (1280x720)
dxva2:we got 2 decoder configurations
dxva2:configuration[0] ConfigBitstreamRaw 1
dxva2:configuration[1] ConfigBitstreamRaw 1
dxva2:IDirectXVideoDecoderService_CreateVideoDecoder succeed
dxva2:Using DXVA2 for hardware decoding
dxva2:Available decoder output format 61 (AV_PIX_FMT_DXVA2_VLD)
encx264: min-keyint: 30, keyint: 300
encx264: encoding at constant RF 25.000000
dxva2:Available decoder output format 61 (AV_PIX_FMT_DXVA2_VLD)

However, even with current svn6240, handbrake activity log doesn't display the above log mentioning DXVA2.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: Nightly DXVA decoding broken

Post by s55 »

Huh? I just noticed when bicubic (opencl) is used, the output video is very pixelated, like literally. Several build ago, it was working fine.
There are quite a few problems with the OpenCL and DXVA code. They are not new and only come up in particular circumstances. (Even on the same file, one encode may work and one won't depending on settings)
Chances of these being fixed anytime soon are pretty slim. No-one is working on this code any more. I've even found some pretty erratic behaviour within graphics drivers. (Not just with HandBrake but other apps that use DXVA too)

I've been half temped to remove DXVA, as I've found that drivers/hardware can pre-process the video, causing a substantial loss in quality.

Given the problems and quality loss with bicubic scaling, I'm more and more tempted to also remove it, and maybe work on getting the OpenCL Decomb code working instead. I think there is a larger potential in the filters than the scaling (which was only using around 5% CPU anyway)

I'm not 100% sure, but your CPU may actually be faster than DXVA decode on the GPU. On my i7 4770K/AMD 7850, DXVA is 132fps slower using the "Normal" preset.
Unless your encode speeds are below what you would normally need for 1080p playback, (i.e around 60fps) it's probably better to use the CPU.
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

Actually, best quality isn't my priority. I prefer a balance between quality and speed.

Example (transcoding 1280x720 h264 to 864x480 without opencl bicubic resizing. Lanczos3 being used);

1)If DXVA is being used, I could use x264 'Fast' preset and get 125fps while maxing 100% CPU utilization. A balanced utilization between quality and speed.

2)If no DXVA, I am forced to use x264 'Superfast' preset just to attain the same 125fps while maxing 100% CPU utilization because CPU will be used for decoding

3)Another scenario where DXVA becomes bottleneck. If I use DXVA and select x264 'Superfast', I only get 120fps while getting 66% average CPU utilization.

Edit: Just spent the last cent of my money purchasing old Q8200 and old ATI HD 5450......I sure envy the developer of having such high end system :lol:
ashleylai87
Posts: 33
Joined: Tue Jul 30, 2013 3:54 am

Re: Nightly DXVA decoding broken

Post by ashleylai87 »

*Bump*
0.10 Release Candidate 2 = DXVA decoding still broken (it is not used even if the checkbox ticked with 'accelerate-able files')
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: Nightly DXVA decoding broken

Post by JohnAStebbins »

ashleylai87 wrote:*Bump*
0.10 Release Candidate 2 = DXVA decoding still broken (it is not used even if the checkbox ticked with 'accelerate-able files')
s55 wrote: Chances of these being fixed anytime soon are pretty slim. No-one is working on this code any more. I've even found some pretty erratic behaviour within graphics drivers. (Not just with HandBrake but other apps that use DXVA too)

Given the problems and quality loss with bicubic scaling, I'm more and more tempted to also remove it...
Post Reply