Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 10/14] avcodec/roqvideo: Use void*, not AVCodecContext* for logctx
Date: Thu, 28 Sep 2023 23:35:44 +0200
Message-ID: <AS8P250MB0744459E5065BD5902202ABE8FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744136FB53B9E573DD249D68FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Also stop setting the field once per encode-frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/roqvideo.c    | 4 ++--
 libavcodec/roqvideo.h    | 4 ++--
 libavcodec/roqvideodec.c | 8 ++++----
 libavcodec/roqvideoenc.c | 8 +++-----
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c
index f9a3c8e083..ca8c8de967 100644
--- a/libavcodec/roqvideo.c
+++ b/libavcodec/roqvideo.c
@@ -111,13 +111,13 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax
     /* check MV against frame boundaries */
     if ((mx < 0) || (mx > ri->width - sz) ||
         (my < 0) || (my > ri->height - sz)) {
-        av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
+        av_log(ri->logctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
             mx, my, ri->width, ri->height);
         return;
     }
 
     if (!ri->last_frame->data[0]) {
-        av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
+        av_log(ri->logctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
         return;
     }
 
diff --git a/libavcodec/roqvideo.h b/libavcodec/roqvideo.h
index 8318b6e5a0..2c2e42884d 100644
--- a/libavcodec/roqvideo.h
+++ b/libavcodec/roqvideo.h
@@ -22,7 +22,7 @@
 #ifndef AVCODEC_ROQVIDEO_H
 #define AVCODEC_ROQVIDEO_H
 
-#include "avcodec.h"
+#include "libavutil/frame.h"
 
 typedef struct roq_cell {
     unsigned char y[4];
@@ -39,7 +39,7 @@ typedef struct motion_vect {
 
 typedef struct RoqContext {
     const AVClass *class;
-    AVCodecContext *avctx;
+    void *logctx;
     AVFrame *last_frame;
     AVFrame *current_frame;
     int width, height;
diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
index 6f2e48d2f3..bfc69a65c9 100644
--- a/libavcodec/roqvideodec.c
+++ b/libavcodec/roqvideodec.c
@@ -72,7 +72,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb)
     xpos = ypos = 0;
 
     if (chunk_size > bytestream2_get_bytes_left(gb)) {
-        av_log(ri->avctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n");
+        av_log(ri->logctx, AV_LOG_ERROR, "Chunk does not fit in input buffer\n");
         chunk_size = bytestream2_get_bytes_left(gb);
     }
 
@@ -80,7 +80,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb)
         for (yp = ypos; yp < ypos + 16; yp += 8)
             for (xp = xpos; xp < xpos + 16; xp += 8) {
                 if (bytestream2_tell(gb) >= chunk_start + chunk_size) {
-                    av_log(ri->avctx, AV_LOG_VERBOSE, "Chunk is too short\n");
+                    av_log(ri->logctx, AV_LOG_VERBOSE, "Chunk is too short\n");
                     return;
                 }
                 if (vqflg_pos < 0) {
@@ -114,7 +114,7 @@ static void roqvideo_decode_frame(RoqContext *ri, GetByteContext *gb)
                         if(k & 0x02) y += 4;
 
                         if (bytestream2_tell(gb) >= chunk_start + chunk_size) {
-                            av_log(ri->avctx, AV_LOG_VERBOSE, "Chunk is too short\n");
+                            av_log(ri->logctx, AV_LOG_VERBOSE, "Chunk is too short\n");
                             return;
                         }
                         if (vqflg_pos < 0) {
@@ -169,7 +169,7 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
 {
     RoqContext *s = avctx->priv_data;
 
-    s->avctx = avctx;
+    s->logctx = avctx;
 
     if (avctx->width % 16 || avctx->height % 16) {
         avpriv_request_sample(avctx, "Dimensions not being a multiple of 16");
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index c25aa39b73..0933abf4f9 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -911,10 +911,10 @@ static int roq_encode_video(RoqEncContext *enc)
     /* Quake 3 can't handle chunks bigger than 65535 bytes */
     if (tempData->mainChunkSize/8 > 65535 && enc->quake3_compat) {
         if (enc->lambda > 100000) {
-            av_log(roq->avctx, AV_LOG_ERROR, "Cannot encode video in Quake compatible form\n");
+            av_log(roq->logctx, AV_LOG_ERROR, "Cannot encode video in Quake compatible form\n");
             return AVERROR(EINVAL);
         }
-        av_log(roq->avctx, AV_LOG_ERROR,
+        av_log(roq->logctx, AV_LOG_ERROR,
                "Warning, generated a frame too big for Quake (%d > 65535), "
                "now switching to a bigger qscale value.\n",
                tempData->mainChunkSize/8);
@@ -972,7 +972,7 @@ static av_cold int roq_encode_init(AVCodecContext *avctx)
 
     av_lfg_init(&enc->randctx, 1);
 
-    roq->avctx = avctx;
+    roq->logctx = avctx;
 
     enc->framesSinceKeyframe = 0;
     if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
@@ -1057,8 +1057,6 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     RoqContext    *const roq = &enc->common;
     int size, ret;
 
-    roq->avctx = avctx;
-
     enc->frame_to_enc = frame;
 
     if (frame->quality)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-09-28 21:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 21:32 [FFmpeg-devel] [PATCH 01/14] configure: Remove obsolete wmavoice->rdft, dct dependencies Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 02/14] configure: Remove obsolete ffplay->rdft dependency Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 03/14] configure: Remove unnecessary vf_spp->fft dependency Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 04/14] avcodec/mpegaudiodsp: Init dct32 directly Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 06/14] configure: Remove dct, fft, mdct, rdft subsystems Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 07/14] avcodec/vorbis: Use void* logctx instead of AVCodecContext* Andreas Rheinhardt
2023-09-30 10:28   ` Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 08/14] avcodec/utvideo: Split UTvideoContext into decoder and encoder contexts Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 09/14] avcodec/sipr: Remove write-only AVCodecContext* Andreas Rheinhardt
2023-09-28 21:35 ` Andreas Rheinhardt [this message]
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 11/14] avcodec/opus_silk: Use void* instead of AVCodecContext* as logctx Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 12/14] avcodec/lagarith: " Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 13/14] avcodec/flac_parse: " Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 14/14] avcodec/bgmc: " Andreas Rheinhardt
2023-09-28 21:42 ` [FFmpeg-devel] [PATCH 01/14] configure: Remove obsolete wmavoice->rdft, dct dependencies Andreas Rheinhardt
2023-09-28 21:59   ` Lynne
2023-09-28 22:11     ` Andreas Rheinhardt
2023-09-28 23:26       ` Lynne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744459E5065BD5902202ABE8FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git