WorkingWithImages のバックアップソース(No.2)

あらゆる画像は、pitchを与えられます。pitchは、基本的に、"1ラインの長さ"として説明されうるものです。おかしいのは、pitchは画像の幅と等しくなくてもよいということです。

たとえば、画像をいくらかクロップ(Crop)する場合、変わるのは画像の幅だけです。pitchとラインの実バイト数は、同じままです。

そのとき、画像は、このようにレイアウトされます:

 rrrrrrrrrrrrrrrrpppp
 rrrrrrrrrrrrrrrrpppp
 rrrrrrrrrrrrrrrrpppp

'r'が使われた画像内の画素であるとすると、'p'は各ラインの後に挿入されたパディング((訳者註: 「[[ASCII24 - アスキー デジタル用語辞典 - パディング:http://yougo.ascii24.com/gh/33/003305.html]]」参照。))です。

***Fast Information [#l529bede]

'''Width''' = width in pixels.

'''Rowsize''' = number of bytes in one line.

'''Pitch''' = distance from start of one line to the next in bytes.

'''vi->BytesFromPixels(n)''' = size of n pixels in bytes - does NOT take pitch into consideration, so can only be used within a line.

For the PlanarImageFormat:

Aligned rowsize = width in bytes, always divisible with 8.

***VideoInfo vs. PVideoFrame [#uf6eb35e]
VideoInfo is considered the "constant" video info. This cannot change in any way. The information such as width, height and colorspace cannot change. So the information you get from this can be trusted to be the same from all frames you recieve. If you change the VideoInfo you have received it will not change the frames you receive, but a modified 'VideoInfo vi' can be sent to env->NewVideoFrame(vi) and a new frame with the changed parameters will be created. Only your own filter can modify the VideoInfo given to your filter.

PVideoFrame contains information about a particular frame you requested. Height and Rowsize should not change (this can be considered a bug). Pitch can change, so ''you cannot rely on pitch being the same for all frames you recieve.''

***More Information [#g9d21193]

See more about DataStorageInAviSynth.~
See more about ColorSpaces.

#hr
//註: このページは、http://www.avisynth.org/WorkingWithImagesの日本語訳です。