summaryrefslogtreecommitdiff
path: root/libavcodec/wmv2enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-27 23:32:49 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-13 15:27:48 +0100
commitcc90478967431d046b2d930a60be15e81c7d0e12 (patch)
treea4af17069bfc6b4a3ed819cfdb51c7cf28b366e3 /libavcodec/wmv2enc.c
parent584f26db0d8e4a2d34ec027b6bc70a9b2eb14926 (diff)
avcodec/wmv2: Split Wmv2Context into decoder and encoder context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/wmv2enc.c')
-rw-r--r--libavcodec/wmv2enc.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index ab5365d1f6..a7827f3194 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -25,8 +25,21 @@
#include "msmpeg4data.h"
#include "wmv2.h"
-
-static int encode_ext_header(Wmv2Context *w)
+typedef struct WMV2EncContext {
+ MpegEncContext s;
+ WMV2Context common;
+ int j_type_bit;
+ int j_type;
+ int abt_flag;
+ int abt_type;
+ int per_mb_abt;
+ int mspel_bit;
+ int cbp_table_index;
+ int top_left_mv_flag;
+ int per_mb_rl_bit;
+} WMV2EncContext;
+
+static int encode_ext_header(WMV2EncContext *w)
{
MpegEncContext *const s = &w->s;
PutBitContext pb;
@@ -54,12 +67,14 @@ static int encode_ext_header(Wmv2Context *w)
static av_cold int wmv2_encode_init(AVCodecContext *avctx)
{
- Wmv2Context *const w = avctx->priv_data;
+ WMV2EncContext *const w = avctx->priv_data;
+ MpegEncContext *const s = &w->s;
+ s->private_ctx = &w->common;
if (ff_mpv_encode_init(avctx) < 0)
return -1;
- ff_wmv2_common_init(w);
+ ff_wmv2_common_init(&w->s);
avctx->extradata_size = 4;
avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
@@ -73,7 +88,7 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx)
int ff_wmv2_encode_picture_header(MpegEncContext *s, int picture_number)
{
- Wmv2Context *const w = (Wmv2Context *) s;
+ WMV2EncContext *const w = (WMV2EncContext *) s;
put_bits(&s->pb, 1, s->pict_type - 1);
if (s->pict_type == AV_PICTURE_TYPE_I)
@@ -147,7 +162,7 @@ int ff_wmv2_encode_picture_header(MpegEncContext *s, int picture_number)
void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64],
int motion_x, int motion_y)
{
- Wmv2Context *const w = (Wmv2Context *) s;
+ WMV2EncContext *const w = (WMV2EncContext *) s;
int cbp, coded_cbp, i;
int pred_x, pred_y;
uint8_t *coded_block;
@@ -220,7 +235,7 @@ const AVCodec ff_wmv2_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WMV2,
.priv_class = &ff_mpv_enc_class,
- .priv_data_size = sizeof(Wmv2Context),
+ .priv_data_size = sizeof(WMV2EncContext),
.init = wmv2_encode_init,
.encode2 = ff_mpv_encode_picture,
.close = ff_mpv_encode_end,