Two-dimensional template matching in a SIMD processor comprising:
- A) a set of vector registers wherein each vector register comprises N elements,
- B) one or more subset group of said vector registers with ability to shift all elements of multiple vector registers in unison in left or right direction,
- C) a subset group of said vector registers with ability to load in a ripple-through fashion, whereby loading the first or last vector register elements, causes all vector register elements for that group to shift from one vector registers' elements to adjacent vector registers' element in the direction away from the loaded vector register,
- D) a block matching execution unit operably coupled to two said vector register groups uses two sets of M pixels by K line block of values as inputs and calculates block matching value for all data positions of block in parallel,
- E) a vector load and store unit that handles transfers between said vector registers and data memory,
- F) a vector arithmetic unit for vector arithmetic and logical operations, and
- G) a program flow control unit,
- whereby best match for motion estimation is found by shifting said vector registers containing candidate block and its neighborhood vertically or horizontally, and calculating the two-dimensional template-match value at each shift step, and
- whereby, in an image coding system, block based motion estimation is performed in a programmable processor, wherein an instruction set extension hardware unit compares new block-matching value output with previous best match value, or a constant value if none was done before, and stores away the best match value and the corresponding horizontal and vertical position values for the best match, wherein certain elements of M by K block could be masked from SAD calculation using a mask register or one of the bits of reference block to signal masking for a given element position, whereby the effective block size is reduced, wherein block-matching calculations and vector load and store operations to perform search area update are performed in parallel, whereby a block-matching logic selects inputs from a certain set of registers, and the rest of the vector registers could be loaded concurrently with block matching calculations and/or shifting of vector register elements connected to block matching logic, wherein reference block of M by K values are stored as part of a group of vector registers and block matching logic inputs for reference block is operably connected to certain vector register elements, 4 wherein the value of M is 4, 8 or 16, wherein the value of K is 4, 8 or 16, wherein the value of N is 8, 16, 32, 64, 128, or 256.