[FFmpeg-cvslog] libopenjpegenc: Remove two redundant function parameters.

Michael Bradshaw git at videolan.org
Tue Jan 17 12:02:48 CET 2012


ffmpeg | branch: master | Michael Bradshaw <mbradshaw at sorensonmedia.com> | Tue Jan 17 12:01:42 2012 +0100| [56af084cb5478bc3c0eb2d47d47e82bbe40fbf2d] | committer: Carl Eugen Hoyos

libopenjpegenc: Remove two redundant function parameters.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56af084cb5478bc3c0eb2d47d47e82bbe40fbf2d
---

 libavcodec/libopenjpegenc.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index b0dca03..188dbb9 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -197,13 +197,12 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image, int numcomps)
+static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image)
 {
     int compno;
     int x;
     int y;
-
-    av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
+    const int numcomps = image->numcomps;
 
     for (compno = 0; compno < numcomps; ++compno) {
         if (image->comps[compno].w > frame->linesize[0] / numcomps) {
@@ -223,15 +222,14 @@ static int libopenjpeg_copy_packed8(AVCodecContext *avctx, AVFrame *frame, opj_i
     return 1;
 }
 
-static int libopenjpeg_copy_packed16(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image, int numcomps)
+static int libopenjpeg_copy_packed16(AVCodecContext *avctx, AVFrame *frame, opj_image_t *image)
 {
     int compno;
     int x;
     int y;
+    const int numcomps = image->numcomps;
     uint16_t *frame_ptr = (uint16_t*)frame->data[0];
 
-    av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
-
     for (compno = 0; compno < numcomps; ++compno) {
         if (image->comps[compno].w > frame->linesize[0] / numcomps) {
             av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
@@ -329,16 +327,12 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf
 
     switch (avctx->pix_fmt) {
     case PIX_FMT_RGB24:
-        cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 3);
-        break;
     case PIX_FMT_RGBA:
-        cpyresult = libopenjpeg_copy_packed8(avctx, frame, image, 4);
+        cpyresult = libopenjpeg_copy_packed8(avctx, frame, image);
         break;
     case PIX_FMT_RGB48:
-        cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 3);
-        break;
     case PIX_FMT_RGBA64:
-        cpyresult = libopenjpeg_copy_packed16(avctx, frame, image, 4);
+        cpyresult = libopenjpeg_copy_packed16(avctx, frame, image);
         break;
     case PIX_FMT_GRAY8:
     case PIX_FMT_YUV420P:



More information about the ffmpeg-cvslog mailing list