OSDN Git Service

vp8 encoder parameter check - do not check for ref frames if no no_ref_X flag is set
authorottingerg <g.ottinger@gmx.at>
Fri, 11 May 2018 07:54:31 +0000 (09:54 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 18 May 2018 08:35:35 +0000 (16:35 +0800)
In VP8 encoding not always all reference frames (last, golden, altref) are provided.
This is indicated with the flags ref_flags.bits.no_ref_last, ref_flags.bits.no_ref_gf
and ref_flags.bits.no_ref_arf in VAEncPictureParameterBufferVP8.
While checking picture parameters, make sure that assert errors concerning invalid
reference frame only occure if no_ref_X is not set.

src/i965_encoder.c

index 3aab36c..8cfdfe5 100644 (file)
@@ -1154,32 +1154,39 @@ intel_encoder_check_vp8_parameter(VADriverContextP ctx,
     encode_state->coded_buf_object = obj_buffer;
 
     if (!is_key_frame) {
-        assert(pic_param->ref_last_frame != VA_INVALID_SURFACE);
-        obj_surface = SURFACE(pic_param->ref_last_frame);
-        assert(obj_surface && obj_surface->bo);
 
-        if (!obj_surface || !obj_surface->bo)
-            goto error;
+        if(!pic_param->ref_flags.bits.no_ref_last) {
+            assert(pic_param->ref_last_frame != VA_INVALID_SURFACE);
+            obj_surface = SURFACE(pic_param->ref_last_frame);
+            assert(obj_surface && obj_surface->bo);
 
-        encode_state->reference_objects[i++] = obj_surface;
+            if (!obj_surface || !obj_surface->bo)
+                goto error;
 
-        assert(pic_param->ref_gf_frame != VA_INVALID_SURFACE);
-        obj_surface = SURFACE(pic_param->ref_gf_frame);
-        assert(obj_surface && obj_surface->bo);
+            encode_state->reference_objects[i++] = obj_surface;
+        }
 
-        if (!obj_surface || !obj_surface->bo)
-            goto error;
+        if(!pic_param->ref_flags.bits.no_ref_gf) {
+            assert(pic_param->ref_gf_frame != VA_INVALID_SURFACE);
+            obj_surface = SURFACE(pic_param->ref_gf_frame);
+            assert(obj_surface && obj_surface->bo);
 
-        encode_state->reference_objects[i++] = obj_surface;
+            if (!obj_surface || !obj_surface->bo)
+                goto error;
 
-        assert(pic_param->ref_arf_frame != VA_INVALID_SURFACE);
-        obj_surface = SURFACE(pic_param->ref_arf_frame);
-        assert(obj_surface && obj_surface->bo);
+            encode_state->reference_objects[i++] = obj_surface;
+        }
 
-        if (!obj_surface || !obj_surface->bo)
-            goto error;
+        if(!pic_param->ref_flags.bits.no_ref_arf) {
+            assert(pic_param->ref_arf_frame != VA_INVALID_SURFACE);
+            obj_surface = SURFACE(pic_param->ref_arf_frame);
+            assert(obj_surface && obj_surface->bo);
 
-        encode_state->reference_objects[i++] = obj_surface;
+            if (!obj_surface || !obj_surface->bo)
+                goto error;
+
+            encode_state->reference_objects[i++] = obj_surface;
+        }
     }
 
     for (; i < 16; i++)