Revision 00182190

View differences:

libavcodec/pnm.c
138 138
                avctx->pix_fmt = PIX_FMT_GRAY16BE;
139 139
                if (s->maxval != 65535)
140 140
                    avctx->pix_fmt = PIX_FMT_GRAY16;
141
            } if (avctx->pix_fmt == PIX_FMT_RGB24) {
142
                if (s->maxval > 255)
143
                    avctx->pix_fmt = PIX_FMT_RGB48BE;
141 144
            } else {
142
                av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
145
                av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
143 146
                avctx->pix_fmt = PIX_FMT_NONE;
144 147
                return -1;
145 148
            }
libavcodec/pnmenc.c
63 63
    switch(avctx->pix_fmt) {
64 64
    default:
65 65
        return -1;
66
    case PIX_FMT_RGB48BE:
67
        n = avctx->width * 6;
68
        goto do_read;
66 69
    case PIX_FMT_RGB24:
67 70
        n = avctx->width * 3;
68 71
        goto do_read;
......
195 198
        c = '6';
196 199
        n = avctx->width * 3;
197 200
        break;
201
    case PIX_FMT_RGB48BE:
202
        c = '6';
203
        n = avctx->width * 6;
204
        break;
198 205
    case PIX_FMT_YUV420P:
199 206
        c = '5';
200 207
        n = avctx->width;
......
209 216
    s->bytestream += strlen(s->bytestream);
210 217
    if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
211 218
        snprintf(s->bytestream, s->bytestream_end - s->bytestream,
212
                 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE) ? 255 : 65535);
219
                 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
213 220
        s->bytestream += strlen(s->bytestream);
214 221
    }
215 222

  
......
394 401
    pnm_encode_frame,
395 402
    NULL, //encode_end,
396 403
    pnm_decode_frame,
397
    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
404
    .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
398 405
    .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
399 406
};
400 407
#endif // CONFIG_PPM_ENCODER

Also available in: Unified diff