History

avcodec/roqvideo: Use void*, not AVCodecContext* for logctx

Also stop setting the field once per encode-frame.

Andreas Rheinhardt committed 3 years ago

Commit 08dd0361 parent 7d1401e4 files · +11 −13Browse files

Unified · Split

4 files
  1. libavcodec/roqvideo.c +2 −2
  2. libavcodec/roqvideo.h +2 −2
  3. libavcodec/roqvideodec.c +4 −4
  4. libavcodec/roqvideoenc.c +3 −5
libavcodec/roqvideo.c+2−2
@@ -111,13 +111,13 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax · 110 unmodified lines
111111 /* check MV against frame boundaries */
112112 if ((mx < 0) || (mx > ri->width - sz) ||
113113 (my < 0) || (my > ri->height - sz)) {
114− av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
114+ av_log(ri->logctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
115115 mx, my, ri->width, ri->height);
116116 return;
117117 }
118118
119119 if (!ri->last_frame->data[0]) {
120− av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
120+ av_log(ri->logctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
121121 return;
122122 }
123123
libavcodec/roqvideo.h+2−2
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #ifndef AVCODEC_ROQVIDEO_H
2323 #define AVCODEC_ROQVIDEO_H
2424
25−#include "avcodec.h"
25+#include "libavutil/frame.h"
2626
2727 typedef struct roq_cell {
2828 unsigned char y[4];
@@ -39,7 +39,7 @@ typedef struct motion_vect { · 10 unmodified lines
3939
4040 typedef struct RoqContext {
4141 const AVClass *class;
42− AVCodecContext *avctx;
42+ void *logctx;
4343 AVFrame *last_frame;
4444 AVFrame *current_frame;
4545 int width, height;
libavcodec/roqvideodec.c+4−4
@@ -72,7 +72,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 71 unmodified lines
7272 xpos = ypos = 0;
7373
7474 if (chunk_size > bytestream2_get_bytes_left(gb)) {
75− av_log(ri->avctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n");
75+ av_log(ri->logctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n");
7676 chunk_size = bytestream2_get_bytes_left(gb);
7777 }
7878
@@ -80,7 +80,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 1 unmodified line
8080 for (yp = ypos; yp < ypos + 16; yp += 8)
8181 for (xp = xpos; xp < xpos + 16; xp += 8) {
8282 if (bytestream2_tell(gb) >= chunk_start + chunk_size) {
83− av_log(ri->avctx, AV_LOG_VERBOSE, "Chunk is too short\n");
83+ av_log(ri->logctx, AV_LOG_VERBOSE, "Chunk is too short\n");
8484 return;
8585 }
8686 if (vqflg_pos < 0) {
@@ -114,7 +114,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 27 unmodified lines
114114 if(k & 0x02) y += 4;
115115
116116 if (bytestream2_tell(gb) >= chunk_start + chunk_size) {
117− av_log(ri->avctx, AV_LOG_VERBOSE, "Chunk is too short\n");
117+ av_log(ri->logctx, AV_LOG_VERBOSE, "Chunk is too short\n");
118118 return;
119119 }
120120 if (vqflg_pos < 0) {
@@ -169,7 +169,7 @@ static av_cold int roq_decode_init(AVCodecContext *avctx) · 48 unmodified lines
169169 {
170170 RoqContext *s = avctx->priv_data;
171171
172− s->avctx = avctx;
172+ s->logctx = avctx;
173173
174174 if (avctx->width % 16 || avctx->height % 16) {
175175 avpriv_request_sample(avctx, "Dimensions not being a multiple of 16");
libavcodec/roqvideoenc.c+3−5
@@ -911,10 +911,10 @@ static int roq_encode_video(RoqEncContext *enc) · 910 unmodified lines
911911 /* Quake 3 can't handle chunks bigger than 65535 bytes */
912912 if (tempData->mainChunkSize/8 > 65535 && enc->quake3_compat) {
913913 if (enc->lambda > 100000) {
914− av_log(roq->avctx, AV_LOG_ERROR, "Cannot encode video in Quake compatible form\n");
914+ av_log(roq->logctx, AV_LOG_ERROR, "Cannot encode video in Quake compatible form\n");
915915 return AVERROR(EINVAL);
916916 }
917− av_log(roq->avctx, AV_LOG_ERROR,
917+ av_log(roq->logctx, AV_LOG_ERROR,
918918 "Warning, generated a frame too big for Quake (%d > 65535), "
919919 "now switching to a bigger qscale value.\n",
920920 tempData->mainChunkSize/8);
@@ -972,7 +972,7 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) · 51 unmodified lines
972972
973973 av_lfg_init(&enc->randctx, 1);
974974
975− roq->avctx = avctx;
975+ roq->logctx = avctx;
976976
977977 enc->framesSinceKeyframe = 0;
978978 if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
@@ -1057,8 +1057,6 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 78 unmodified lines
10571057 RoqContext *const roq = &enc->common;
10581058 int size, ret;
10591059
1060− roq->avctx = avctx;
1061−
10621060 enc->frame_to_enc = frame;
10631061
10641062 if (frame->quality)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t