Also stop setting the field once per encode-frame.
Showing the changes to libavcodec (4 of 4 files). Show all
Unified · Split
| @@ -111,13 +111,13 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax · 110 unmodified lines | ||
| 111 | 111 | /* check MV against frame boundaries */ |
| 112 | 112 | if ((mx < 0) || (mx > ri->width - sz) || |
| 113 | 113 | (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", | |
| 115 | 115 | mx, my, ri->width, ri->height); |
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | 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"); | |
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #ifndef AVCODEC_ROQVIDEO_H |
| 23 | 23 | #define AVCODEC_ROQVIDEO_H |
| 24 | 24 | |
| 25 | −#include "avcodec.h" | |
| 25 | +#include "libavutil/frame.h" | |
| 26 | 26 | |
| 27 | 27 | typedef struct roq_cell { |
| 28 | 28 | unsigned char y[4]; |
| @@ -39,7 +39,7 @@ typedef struct motion_vect { · 10 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | typedef struct RoqContext { |
| 41 | 41 | const AVClass *class; |
| 42 | − AVCodecContext *avctx; | |
| 42 | + void *logctx; | |
| 43 | 43 | AVFrame *last_frame; |
| 44 | 44 | AVFrame *current_frame; |
| 45 | 45 | int width, height; |
| @@ -72,7 +72,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 71 unmodified lines | ||
| 72 | 72 | xpos = ypos = 0; |
| 73 | 73 | |
| 74 | 74 | 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"); | |
| 76 | 76 | chunk_size = bytestream2_get_bytes_left(gb); |
| 77 | 77 | } |
| 78 | 78 | |
| @@ -80,7 +80,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 1 unmodified line | ||
| 80 | 80 | for (yp = ypos; yp < ypos + 16; yp += 8) |
| 81 | 81 | for (xp = xpos; xp < xpos + 16; xp += 8) { |
| 82 | 82 | 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"); | |
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | if (vqflg_pos < 0) { |
| @@ -114,7 +114,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb) · 27 unmodified lines | ||
| 114 | 114 | if(k & 0x02) y += 4; |
| 115 | 115 | |
| 116 | 116 | 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"); | |
| 118 | 118 | return; |
| 119 | 119 | } |
| 120 | 120 | if (vqflg_pos < 0) { |
| @@ -169,7 +169,7 @@ static av_cold int roq_decode_init(AVCodecContext *avctx) · 48 unmodified lines | ||
| 169 | 169 | { |
| 170 | 170 | RoqContext *s = avctx->priv_data; |
| 171 | 171 | |
| 172 | − s->avctx = avctx; | |
| 172 | + s->logctx = avctx; | |
| 173 | 173 | |
| 174 | 174 | if (avctx->width % 16 || avctx->height % 16) { |
| 175 | 175 | avpriv_request_sample(avctx, "Dimensions not being a multiple of 16"); |
| @@ -911,10 +911,10 @@ static int roq_encode_video(RoqEncContext *enc) · 910 unmodified lines | ||
| 911 | 911 | /* Quake 3 can't handle chunks bigger than 65535 bytes */ |
| 912 | 912 | if (tempData->mainChunkSize/8 > 65535 && enc->quake3_compat) { |
| 913 | 913 | 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"); | |
| 915 | 915 | return AVERROR(EINVAL); |
| 916 | 916 | } |
| 917 | − av_log(roq->avctx, AV_LOG_ERROR, | |
| 917 | + av_log(roq->logctx, AV_LOG_ERROR, | |
| 918 | 918 | "Warning, generated a frame too big for Quake (%d > 65535), " |
| 919 | 919 | "now switching to a bigger qscale value.\n", |
| 920 | 920 | tempData->mainChunkSize/8); |
| @@ -972,7 +972,7 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) · 51 unmodified lines | ||
| 972 | 972 | |
| 973 | 973 | av_lfg_init(&enc->randctx, 1); |
| 974 | 974 | |
| 975 | − roq->avctx = avctx; | |
| 975 | + roq->logctx = avctx; | |
| 976 | 976 | |
| 977 | 977 | enc->framesSinceKeyframe = 0; |
| 978 | 978 | if ((avctx->width & 0xf) || (avctx->height & 0xf)) { |
| @@ -1057,8 +1057,6 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 78 unmodified lines | ||
| 1057 | 1057 | RoqContext *const roq = &enc->common; |
| 1058 | 1058 | int size, ret; |
| 1059 | 1059 | |
| 1060 | − roq->avctx = avctx; | |
| 1061 | − | |
| 1062 | 1060 | enc->frame_to_enc = frame; |
| 1063 | 1061 | |
| 1064 | 1062 | if (frame->quality) |