+typedef struct RoqCodebooks {
+ int numCB4;
+ int numCB2;
+ int usedCB2[MAX_CBS_2x2];
+ int usedCB4[MAX_CBS_4x4];
+ uint8_t unpacked_cb2[MAX_CBS_2x2*2*2*3];
+ uint8_t unpacked_cb4[MAX_CBS_4x4*4*4*3];
+ uint8_t unpacked_cb4_enlarged[MAX_CBS_4x4*8*8*3];
+} RoqCodebooks;
+
+/**
+ * Temporary vars
+ */
+typedef struct RoqTempData
+{
+ int f2i4[MAX_CBS_4x4];
+ int i2f4[MAX_CBS_4x4];
+ int f2i2[MAX_CBS_2x2];
+ int i2f2[MAX_CBS_2x2];
+
+ int mainChunkSize;
+
+ int numCB4;
+ int numCB2;
+
+ RoqCodebooks codebooks;
+
+ int used_option[4];
+} RoqTempData;
+
+typedef struct SubcelEvaluation {
+ int eval_dist[4];
+ int best_bit_use;
+ int best_coding;
+
+ int subCels[4];
+ motion_vect motion;
+ int cbEntry;
+} SubcelEvaluation;
+
+typedef struct CelEvaluation {
+ int eval_dist[4];
+ int best_coding;
+
+ SubcelEvaluation subCels[4];
+
+ motion_vect motion;
+ int cbEntry;
+
+ int sourceX, sourceY;
+} CelEvaluation;
+
+typedef struct RoqEncContext {
+ RoqContext common;
+ AVLFG randctx;
+ uint64_t lambda;
+
+ motion_vect *this_motion4;
+ motion_vect *last_motion4;
+
+ motion_vect *this_motion8;
+ motion_vect *last_motion8;
+
+ unsigned int framesSinceKeyframe;
+
+ const AVFrame *frame_to_enc;
+ uint8_t *out_buf;
+ RoqTempData tmp_data;
+ roq_cell results4[4 * MAX_CBS_4x4];
+ int tmp_codebook_buf[FFMAX(24 * MAX_CBS_4x4, 6 * MAX_CBS_2x2)];
+
+ CelEvaluation *cel_evals;
+ int *closest_cb;
+ int *points; // Allocated together with closest_cb
+
+ int first_frame;
+ int quake3_compat; // Quake 3 compatibility option
+} RoqEncContext;
+