| 92 | } |
| 93 | |
| 94 | static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
| 95 | const AVFrame *frame, int *got_packet) |
| 96 | { |
| 97 | SgiContext *s = avctx->priv_data; |
| 98 | const AVFrame * const p = frame; |
| 99 | PutByteContext pbc; |
| 100 | uint8_t *encode_buf; |
| 101 | int x, y, z, length, tablesize, ret, i; |
| 102 | unsigned int width, height, depth, dimension; |
| 103 | unsigned int bytes_per_channel, pixmax, put_be; |
| 104 | |
| 105 | width = avctx->width; |
| 106 | height = avctx->height; |
| 107 | bytes_per_channel = 1; |
| 108 | pixmax = 0xFF; |
| 109 | put_be = HAVE_BIGENDIAN; |
| 110 | |
| 111 | switch (avctx->pix_fmt) { |
| 112 | case AV_PIX_FMT_GRAY8: |
| 113 | dimension = SGI_SINGLE_CHAN; |
| 114 | depth = SGI_GRAYSCALE; |
| 115 | break; |
| 116 | case AV_PIX_FMT_RGB24: |
| 117 | dimension = SGI_MULTI_CHAN; |
| 118 | depth = SGI_RGB; |
| 119 | break; |
| 120 | case AV_PIX_FMT_RGBA: |
| 121 | dimension = SGI_MULTI_CHAN; |
| 122 | depth = SGI_RGBA; |
| 123 | break; |
| 124 | case AV_PIX_FMT_GRAY16LE: |
| 125 | put_be = !HAVE_BIGENDIAN; |
| 126 | case AV_PIX_FMT_GRAY16BE: |
| 127 | bytes_per_channel = 2; |
| 128 | pixmax = 0xFFFF; |
| 129 | dimension = SGI_SINGLE_CHAN; |
| 130 | depth = SGI_GRAYSCALE; |
| 131 | break; |
| 132 | case AV_PIX_FMT_RGB48LE: |
| 133 | put_be = !HAVE_BIGENDIAN; |
| 134 | case AV_PIX_FMT_RGB48BE: |
| 135 | bytes_per_channel = 2; |
| 136 | pixmax = 0xFFFF; |
| 137 | dimension = SGI_MULTI_CHAN; |
| 138 | depth = SGI_RGB; |
| 139 | break; |
| 140 | case AV_PIX_FMT_RGBA64LE: |
| 141 | put_be = !HAVE_BIGENDIAN; |
| 142 | case AV_PIX_FMT_RGBA64BE: |
| 143 | bytes_per_channel = 2; |
| 144 | pixmax = 0xFFFF; |
| 145 | dimension = SGI_MULTI_CHAN; |
| 146 | depth = SGI_RGBA; |
| 147 | break; |
| 148 | default: |
| 149 | return AVERROR_INVALIDDATA; |
| 150 | } |
| 151 |
nothing calls this directly
no test coverage detected