summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg_er.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-06-20 06:05:45 -0700
committerDiego Biurrun <diego@biurrun.de>2014-06-22 17:36:37 -0700
commit7b9ef8d701c319c26f7d0664fe977e176764c74e (patch)
tree651afd8b680afd86e1aca7d6c89fe27514bb9d20 /libavcodec/mpeg_er.c
parentf2f2e7627f0c878d13275af5d166ec5932665e28 (diff)
mpeg: Split error resilience bits off into a separate file
Diffstat (limited to 'libavcodec/mpeg_er.c')
-rw-r--r--libavcodec/mpeg_er.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c
new file mode 100644
index 0000000000..7a1b6b2764
--- /dev/null
+++ b/libavcodec/mpeg_er.c
@@ -0,0 +1,59 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "error_resilience.h"
+#include "mpegvideo.h"
+#include "mpeg_er.h"
+
+static void set_erpic(ERPicture *dst, Picture *src)
+{
+ int i;
+
+ if (!src) {
+ dst->f = NULL;
+ dst->tf = NULL;
+ return;
+ }
+
+ dst->f = src->f;
+ dst->tf = &src->tf;
+
+ for (i = 0; i < 2; i++) {
+ dst->motion_val[i] = src->motion_val[i];
+ dst->ref_index[i] = src->ref_index[i];
+ }
+
+ dst->mb_type = src->mb_type;
+ dst->field_picture = src->field_picture;
+}
+
+void ff_mpeg_er_frame_start(MpegEncContext *s)
+{
+ ERContext *er = &s->er;
+
+ set_erpic(&er->cur_pic, s->current_picture_ptr);
+ set_erpic(&er->next_pic, s->next_picture_ptr);
+ set_erpic(&er->last_pic, s->last_picture_ptr);
+
+ er->pp_time = s->pp_time;
+ er->pb_time = s->pb_time;
+ er->quarter_sample = s->quarter_sample;
+ er->partitioned_frame = s->partitioned_frame;
+
+ ff_er_frame_start(er);
+}