st/va: create decoder for MJPEG format
authorLeo Liu <leo.liu@amd.com>
Tue, 15 Aug 2017 16:06:24 +0000 (12:06 -0400)
committerLeo Liu <leo.liu@amd.com>
Mon, 21 Aug 2017 14:09:09 +0000 (10:09 -0400)
Mjpeg doesn't need reference

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/picture.c

index 338e0902d658a7dbf5da16c70b8246fbc6b3b90d..30617e8cfe72f776a71befff09ccd8f145ddc3e4 100644 (file)
@@ -170,14 +170,17 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
 
    /* Create the decoder once max_references is known. */
    if (!context->decoder) {
+      enum pipe_video_format format =
+         u_reduce_video_profile(context->templat.profile);
+
       if (!context->target)
          return VA_STATUS_ERROR_INVALID_CONTEXT;
 
-      if (context->templat.max_references == 0)
+      if (context->templat.max_references == 0 &&
+         format != PIPE_VIDEO_FORMAT_JPEG)
          return VA_STATUS_ERROR_INVALID_BUFFER;
 
-      if (u_reduce_video_profile(context->templat.profile) ==
-          PIPE_VIDEO_FORMAT_MPEG4_AVC)
+      if (format == PIPE_VIDEO_FORMAT_MPEG4_AVC)
          context->templat.level = u_get_h264_level(context->templat.width,
             context->templat.height, &context->templat.max_references);