hevc: do not change the VPS if its contents are the same
authorAnton Khirnov <anton@khirnov.net>
Sun, 29 Mar 2015 13:20:30 +0000 (15:20 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 3 Apr 2015 11:10:03 +0000 (13:10 +0200)
This is the same as is done for SPS.

libavcodec/hevc_ps.c

index db658be..631dca8 100644 (file)
@@ -407,8 +407,14 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
     }
     get_bits1(gb); /* vps_extension_flag */
 
     }
     get_bits1(gb); /* vps_extension_flag */
 
-    av_buffer_unref(&s->vps_list[vps_id]);
-    s->vps_list[vps_id] = vps_buf;
+    if (s->vps_list[vps_id] &&
+        !memcmp(s->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) {
+        av_buffer_unref(&vps_buf);
+    } else {
+        av_buffer_unref(&s->vps_list[vps_id]);
+        s->vps_list[vps_id] = vps_buf;
+    }
+
     return 0;
 
 err:
     return 0;
 
 err: