After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796705 - vaapijpegenc: Encoding JPEG will result in green/black display encoded output
vaapijpegenc: Encoding JPEG will result in green/black display encoded output
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
1.x
Other Linux
: Normal normal
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-06-28 13:20 UTC by Tianhao
Modified: 2018-07-04 10:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set component identifier and quantization table destination selector in frame header (1.68 KB, patch)
2018-06-28 13:32 UTC, Tianhao
needs-work Details | Review
set component identifier and quantization table destination selector in frame header (1.56 KB, patch)
2018-07-02 07:18 UTC, Tianhao
none Details | Review
set component identifier and quantization table destination selector in frame header (2.30 KB, patch)
2018-07-04 04:56 UTC, Tianhao
committed Details | Review

Description Tianhao 2018-06-28 13:20:32 UTC
[System Environment]
Platform : APL
Kernel : 4.17-rc3
libva : master branch d6fd111e2062bb4732db8a05ed55fc01771087b4
gst-vaapi : 1.14.0

[Defect description]
Encoding JPEG looks successful either using raw file or videotestsrc. However, encoded content was showing green (using glimagesink) or black (using vaapisink) screen when trying to playback.

[Reproduce Steps]

    Encoded command:
    raw input file
    $ gst-launch-1.0 -v filesrc location=/home/root/videos/raw/NV12_Prog_Planar_720x480.yuv ! videoparse width=720 height=480 format=nv12 ! vaapijpegenc quality=100 ! avimux ! filesink location=test.avi

    videotestsrc
    $ gst-launch-1.0 -v videotestsrc num-buffers=100 ! video/x-raw,format=NV12 ! vaapijpegenc ! avimux ! filesink location=test.avi

    Playback command:
    glimagesink
    $ GST_GL_PLATFORM=egl gst-launch-1.0 filesrc location= /media/test.avi ! avidemux ! vaapijpegdec ! vaapipostproc ! glimagesink

    vaapisink
    $ gst-launch-1.0 filesrc location= /media/test.avi ! avidemux ! vaapijpegdec ! vaapipostproc ! vaapisink
Comment 1 Tianhao 2018-06-28 13:32:17 UTC
Created attachment 372862 [details] [review]
set component identifier and quantization table destination selector in frame header
Comment 2 Tianhao 2018-07-02 03:04:32 UTC
Victor, could you review my patches?
Comment 3 Víctor Manuel Jáquez Leal 2018-07-02 05:01:24 UTC
Review of attachment 372862 [details] [review]:

Overall it looks good.

Just a couple nitpicks:

1. The commit log format: the subject, if possible, should be 50 chars long, with prefix "libs: encoder: jpeg: ..." 
2. Wrap the body to 72 chars

https://chris.beams.io/posts/git-commit/#seven-rules

In my opinion is important to remark the importance of the patch regardless the va backend, setting the component id and Tqi

::: gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c
@@ +229,3 @@
+    pic_param->component_id[i] = i + 1;
+    if (i == 0)
+      pic_param->quantiser_table_selector[i] = 0;

There is no need to set zero, since the structure is already set to zero.
Comment 4 Tianhao 2018-07-02 07:18:45 UTC
Created attachment 372909 [details] [review]
set component identifier and quantization table destination selector in frame header
Comment 5 Tianhao 2018-07-02 07:21:14 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #3)
> Review of attachment 372862 [details] [review] [review]:
> 
> Overall it looks good.
> 
> Just a couple nitpicks:
> 
> 1. The commit log format: the subject, if possible, should be 50 chars long,
> with prefix "libs: encoder: jpeg: ..." 
> 2. Wrap the body to 72 chars
> 
> https://chris.beams.io/posts/git-commit/#seven-rules
> 
> In my opinion is important to remark the importance of the patch regardless
> the va backend, setting the component id and Tqi
> 
> ::: gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c
> @@ +229,3 @@
> +    pic_param->component_id[i] = i + 1;
> +    if (i == 0)
> +      pic_param->quantiser_table_selector[i] = 0;
> 
> There is no need to set zero, since the structure is already set to zero.

Thanks for your review, I'll write a good message and submit a new patch.
Comment 6 Tianhao 2018-07-04 01:25:25 UTC
I change my according your comments.
Victor, could you review my patch?
Comment 7 sreerenj 2018-07-04 03:02:44 UTC
Ideally, we should use the prefilled values in VAEnc* structures (if it is available) to fill up any PackedHeader attributes so that we don't accidentally mess up with different values in both places. The same pattern we have used in all encoder packed header generation.

Here, I would recommend you to use VAEncPictureParameterBufferJPEG's component_id and quantiser_table_selector (which are prefilled by your patch) for packed frame header generation later on.
Comment 8 Tianhao 2018-07-04 04:53:37 UTC
(In reply to sreerenj from comment #7)
> Ideally, we should use the prefilled values in VAEnc* structures (if it is
> available) to fill up any PackedHeader attributes so that we don't
> accidentally mess up with different values in both places. The same pattern
> we have used in all encoder packed header generation.
> 
> Here, I would recommend you to use VAEncPictureParameterBufferJPEG's
> component_id and quantiser_table_selector (which are prefilled by your
> patch) for packed frame header generation later on.

Thanks, I'll follow your recommendation and submit a new patch
Comment 9 Tianhao 2018-07-04 04:56:54 UTC
Created attachment 372946 [details] [review]
set component identifier and quantization table destination selector in frame header
Comment 10 Víctor Manuel Jáquez Leal 2018-07-04 09:05:17 UTC
Review of attachment 372946 [details] [review]:

lgtm