Skip to content

[RK3588] AV1D outputs invalid AFBC image when video width is not a multiple of 64 #935

@nyanmisaka

Description

@nyanmisaka

Works: 1280x720, 1920x1080, 3840x2160, 1984x1080, 1856x1080 (width is a multiple of 64)
Fails: 1936x1080, 3812x1608, ... (width is NOT a multiple of 64)

  • H.264, HEVC, VP9, ​​and other decoders that support AFBC are unaffected at the same resolutions.
  • RK3576 AV1D with RKFBC enabled is also unaffected.

The decoder does not throw any errors, but it will reset the RGA3 hardware, so i believe the AFBC image is invalid:

[44770.737111] rga: 45117  45121 : ID[9520]: destroy when the user exits
[44770.737152] rga: 45117  45129 : RGA3_core0[0x1] soft reset complete.
[44770.737161] rga: 45117  45121 : ID[9520]: reset core[1] by request abort
[44770.737317] rga: 45117  45129 : request[9520] abort! finished 0 failed 0 running_abort 1 todo_abort 0
[44770.737331] rga: 45117  45121 : ID[9521]: destroy when the user exits
[44770.737340] rga: 45117  45129 : RGA3_core1[0x2] soft reset complete.
[44770.737347] rga: 45117  45121 : ID[9521]: reset core[2] by request abort
[44770.737436] rga: 45117  45129 : request[9521] abort! finished 0 failed 0 running_abort 1 todo_abort 0
[44770.737449] rga: 45117  45121 : ID[9522]: destroy when the user exits
[44770.737474] rga: 45117  45129 : request[9522] abort! finished 0 failed 0 running_abort 0 todo_abort 1

For debugging with FF (prebuilt binary):

~/ffmpeg -f lavfi -i testsrc2=s=1936x1080,format=yuv420p -c:v libsvtav1 -preset 10 -y /tmp/1.mp4

~/ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -afbc rga -i /tmp/1.mp4 -vf scale_rkrga=format=nv12 -f null - -v debug

Selecting decoder 'av1_rkmpp' because of requested hwaccel method rkmpp
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomav01iso2mp41
    encoder         : Lavf61.7.100
  Duration: 00:00:16.84, start: 0.000000, bitrate: 6073 kb/s
  Stream #0:0[0x1](und), 1, 1/12800: Video: av1 (libdav1d) (Main), 1 reference frame (av01 / 0x31307661), yuv420p(tv, progressive), 1936x1080, 0/1, 6072 kb/s, SAR 1:1 DAR 242:135, 25 fps, 25 tbr, 12800 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.19.101 libsvtav1
Successfully opened the file.
Parsing a group of options: output url -.
Applying option vf (alias for -filter:v (apply filters to video streams)) with argument scale_rkrga=format=nv12.
Applying option f (force container format (auto-detected otherwise)) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
[out#0/null @ 0xaaaaf5232bd0] No explicit maps, mapping streams automatically...
[vost#0:0/wrapped_avframe @ 0xaaaaf5227a70] Created video stream from input stream 0:0
[AVFilterGraph @ 0xaaaaf5233950] Setting 'format' to value 'nv12'
[av1_rkmpp @ 0xaaaaf5229fe0] Format drm_prime chosen by get_format().
[av1_rkmpp @ 0xaaaaf5229fe0] Picked up an existing RKMPP hardware device
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (av1 (av1_rkmpp) -> wrapped_avframe (native))
[vost#0:0/wrapped_avframe @ 0xaaaaf5227a70] Starting thread...
[vf#0:0 @ 0xaaaaf5227fc0] Starting thread...
[vist#0:0/av1 @ 0xaaaaf5232a30] [dec:av1_rkmpp @ 0xaaaaf5229970] Starting thread...
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xaaaaf521cb80] Starting thread...
Press [q] to stop, [?] for help
[libdav1d @ 0xaaaaf52335e0] Frame 16:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 4:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 8:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 64982 bytes to decoder
[libdav1d @ 0xaaaaf52335e0] Frame 2:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 1:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 6:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 3:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 5:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 7:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 189051 bytes to decoder
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 3 bytes to decoder
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 22898 bytes to decoder
[libdav1d @ 0xaaaaf52335e0] Frame 12:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 10:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 9:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 11:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 14:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 13:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[av1_rkmpp @ 0xaaaaf5229fe0] Noticed an info change
[av1_rkmpp @ 0xaaaaf5229fe0] Decoder options: deint=true afbc=2 fast_parse=true buf_mode=0
[av1_rkmpp @ 0xaaaaf5229fe0] Configured with size: 1936x1080 | pix_fmt: drm_prime | sw_pix_fmt: nv12
[av1_rkmpp @ 0xaaaaf5229fe0] Received a frame
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 3 bytes to decoder
[AVFilterGraph @ 0xffffb0000fb0] Setting 'format' to value 'nv12'
detected 8 logical cores
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'video_size' to value '1936x1080'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'pix_fmt' to value '178'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'time_base' to value '1/12800'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'pixel_aspect' to value '1/1'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'colorspace' to value '2'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'range' to value '1'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] Setting 'frame_rate' to value '25/1'
[graph -1 input from stream 0:0 @ 0xffffb00023c0] w:1936 h:1080 pixfmt:drm_prime tb:1/12800 fr:25/1 sar:1/1 csp:unknown range:tv
[AVFilterGraph @ 0xffffb0000fb0] query_formats: 3 queried, 6 merged, 0 already done, 0 delayed
[Parsed_scale_rkrga_0 @ 0xffffb0002000] w:1936 h:1080 fmt:nv12 -> w:1936 h:1080 fmt:nv12
[graph -1 input from stream 0:0 @ 0xffffb00023c0] video frame properties congruent with link at pts_time: 0
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA src | fd:21 mmu:1 rd:1 csc:0 | x:0 y:8 w:1936 h:1080 ws:1984 hs:1088 fmt:0xa
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA dst | fd:27 mmu:1 rd:0 csc:0 | x:0 y:0 w:1936 h:1080 ws:1984 hs:1080 fmt:0xa
rga_api version 1.10.4_[1]
[av1_rkmpp @ 0xaaaaf5229fe0] Timeout getting decoded frame
[av1_rkmpp @ 0xaaaaf5229fe0] Received a frame
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 49061 bytes to decoder
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 3 bytes to decoder
[libdav1d @ 0xaaaaf52335e0] Frame 15:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[av1_rkmpp @ 0xaaaaf5229fe0] Received a frame
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 22446 bytes to decoder
[av1_rkmpp @ 0xaaaaf5229fe0] Received a frame
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA src | fd:36 mmu:1 rd:1 csc:0 | x:0 y:8 w:1936 h:1080 ws:1984 hs:1088 fmt:0xa
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA dst | fd:39 mmu:1 rd:0 csc:0 | x:0 y:0 w:1936 h:1080 ws:1984 hs:1080 fmt:0xa
[av1_rkmpp @ 0xaaaaf5229fe0] Wrote 3 bytes to decoder
[libdav1d @ 0xaaaaf52335e0] Frame 32:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 24:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 20:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 18:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[libdav1d @ 0xaaaaf52335e0] Frame 17:  size 1936x1080  upscaled 1936  render 1936x1080  subsample 2x2  bitdepth 8  tiles 1x1.
[av1_rkmpp @ 0xaaaaf5229fe0] Received a frame
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA src | fd:34 mmu:1 rd:1 csc:0 | x:0 y:8 w:1936 h:1080 ws:1984 hs:1088 fmt:0xa
[Parsed_scale_rkrga_0 @ 0xffffb0002000] RGA dst | fd:42 mmu:1 rd:0 csc:0 | x:0 y:0 w:1936 h:1080 ws:1984 hs:1080 fmt:0xa
^C^C^CReceived > 3 system signals, hard exiting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions